iOS UIView Init Tip
Apr 14, 2012
Dick Brouwer
1 minute read

Don’t (ever) call [self.view something] in a UIView’s -(id)init method. Why? Calling a UIView’s view will automatically load it if it isn’t already loaded. So in this case, ViewDidLoad will finish before the class is fully initialized (which can cause all kinds of weird bugs).

It makes sense and it’s obvious… after the fact. :)

comments powered by Disqus