Tuesday, September 25, 2012

Print a BOOL in NSLog


BOOL flag = YES;
NSLog(flag ? @"Yes" : @"No");

Friday, September 21, 2012

"Could not instantiate class named NSLayoutConstraint"

Yay new Xcode! Disable auto layout by unchecking the box under File Inspector in xib view:


Friday, September 14, 2012

Objective-C Callbacks


Two classes, one needs to call a method (callingClass) on another (thatClass). Call the method (getList) from the callingClass with the @selector as the callbackMethod which will "do stuff" upon call back. Once getList finishes, callbackMethod will then be called. The callbackMethod will deal with whatever is returned from getList.

Pull to Refresh Table View

Implemented in about 20 minutes. Fork PullToRefresh on Github and start crackin'!
Sonny Parlin Tutorial


Monday, September 10, 2012

Error 'loaded the nib but the view outlet was not set.'


*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "" nib but the view outlet was not set.'


  • Open the XIB file causing problems
  • Click on file's owner icon on the left bar (top one, looks like a yellow outlined box)
  • If you don't see the right-hand sidebar, click on the third icon above "view" in your toolbar. This will show the right-hand sidebar
  • In the right-hand sidebar, click on the third tab--the one that looks a bit like a newspaper
  • Under "Custom Class" at the top, make sure Class is the name of the ViewController that should correspond to this view. If not, enter it
  • In the right-hand sidebar, click on the last tab--the one that looks like a circle with an arrow in it
  • You should see "outlets" with "view" under it. Drag the circle next to it over to the "view" icon on the left bar (bottom one, looks like a white square with a thick gray outline
  • Save the xib and re-run


Blog Archive