Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

darkandlong

macrumors member
Original poster
Jun 19, 2008
64
212
Uk
Hi,

I need to set a property of a UIView (from inside the same UIView, not from its ViewController) based on its initial bounds. What is the earliest point I can access its bounds?

I have tried:

- (id)initWithCoder:(NSCoder *)aDecoder

and

- (void)didMoveToWindow

but in both cased self.bounds is still null.

Thanks.
 
Thanks for your replies.

turns out bounds were available as early as initWithCoder. Problem was I was trying to NSLog the bounds which are a struct and so they were printing as null even though they were there.
 
I'd be careful about using the bounds of any view before viewWillAppear. It seems like any time before that method is called the bounds may or may not have had the correct rotation transform applied.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.