How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

The short answer is that you’re using UINavigationController, and that won’t work like you want it to. From Apple’s docs: Why won’t my UIViewController rotate with the device? All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set. To make sure that all your child view controllers rotate … Read more

Recommended way to declare delegate properties with ARC

Xcode 4 Refactor > Convert to Objective-C ARC transforms: @interface XYZ : NSObject { id delegate; } @property (assign) id delegate; … @synthesize delegate; into: @interface XYZ : NSObject { id __unsafe_unretained delegate; } @property (unsafe_unretained) id delegate; … @synthesize delegate; If I remember correctly it is also mentioned in WWDC 2011 video about ARC.

How to safely shut down a loading UIWebView in viewWillDisappear?

A variation on this should fix both the leaking and zombie issues: – (void)loadRequest:(NSURLRequest *)request { [self retain]; if ([webView isLoading]) [webView stopLoading]; [webView loadRequest:request]; [self release]; } – (void)webViewDidStartLoad:(UIWebView *)webView { [self retain]; } – (void)webViewDidFinishLoad:(UIWebView *)webView { [self release]; } – (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { [self release]; } – (void)viewWillDisappear { if … Read more

Is there an way to make an invisible UIButton that will still “be there” and catch touch events for my UIImageView?

You should be able to set the button’s ‘Type’ to Custom in Interface Builder, and it will not display any text or graphical elements over the UIImageView. This way, you don’t need to adjust the alpha. If the view is built from code, use: button = [UIButton buttonWithType:UIButtonTypeCustom];

tech