1

I'm a tad puzzled with this one.

I'm trying programatically to size some UI elements...

The sizing of the elements is based on the size of the parent view (here the detailed view). (I do not want to use the autosize-mask, simply because I can't get the result I want with those)

When running in landscape mode, reading the frame size of my current view in UIViewDidAppear, the size I get is always 1024 pixels wide, which obviously isn't going to be the case once everything has been displayed (it will be 1024 minus the width of root controller (320 pixels) = 704 pixels wide)

At what time, and where should I expect the view to have been re-sized, so I can accurately read the frame size.

Obviously I want to do this as early as possible in the view life-cycle, and if possible before anything has been drawn so the user won't see that I'm resizing the objects.

Ideally, I wonder if there's a particular function that is called (similar to UIViewWillAppear) that I could place my code into.

Thank you

EmptyStack
  • 51,274
  • 23
  • 147
  • 178
jyavenard
  • 2,142
  • 1
  • 26
  • 35
  • I figure why I do not get called when expected. I use a UISplitViewController in combination with a UITabBarController. – jyavenard Sep 02 '11 at 11:09

2 Answers2

2

You are looking for - (void)layoutSubViews see this question: When is layoutSubviews called?

Community
  • 1
  • 1
Rog
  • 17,070
  • 9
  • 50
  • 73
0

Normally, from the time UIViewDidAppear is called, everything has been resized to normal. However, when you are using a UISplitViewController started from a UITabBarController, the message UIViewDidAppear isn't called as you would expect.

This situation isn't supported in iOS 4 and earlier. Apple's UI guidelines require that you only have one UIView controller per screen (the exception being with UISplitViewController and UITabBarController). Looks like from iOS 5, this situation will be supported.

jyavenard
  • 2,142
  • 1
  • 26
  • 35