Wednesday, July 15, 2009

Easy iPhone landscape orientation

Put one of the following in your AppDelegate's applicationDidFinishLaunching method:
  • application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
  • application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;

This has several benefits:
  • The status bar, keyboard, and alerts are oriented properly
  • The iPhone simulator will orient itself properly

Sunday, July 12, 2009

Some quick cocoa notes

In documentation such as this: "Convenience Constructors" do not seem to require alloc, like so:
NSDate *now = [NSDate date];

"Initializers", on the other hand, require alloc:
NSDate *since = [[NSDate alloc] initWithTimeInterval:0 sinceDate:someOtherDate];