Thursday, January 26, 2012

Positioning UIViews

UIView+position is the most useful category I've come across - so good, I add it to my project's .pch so it's always available. Author Tyler Neylon made this available via a Apache 2 license. You can do all sorts of neat stuff e.g.

view1.frameY = view2.frameBottom
view1.frameWidth = view2.frameHeight

Xcode: How to turn off ARC on individual files

  1. Click on the Project.
  2. Click on the target.
  3. Select build phases tab.
  4. Select the multiple files in which you want to turn off ARC.
  5. Press ENTER / Hit Enter key
  6. Type “-fno-objc-arc” ( without quotes)
For more info: Source Link by Neon Spark

Wednesday, January 25, 2012

Adding a NIB view at runtime


// Add MyView.xib to a UIView, in IB associate MyView.xib and the MyView class
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil];        
MyView* o = [nibViews objectAtIndex:0];
[self addSubview:o];

Wednesday, January 18, 2012

Showing invisible files and folders on the Mac

In Terminal:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder




to hide:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Thursday, January 5, 2012

Xcode 4.2 doesn't generate a stack trace

Xcode 4.2 doesn't generate a stack trace when simulating iOS5. Choosing a 4.x (or older) target in the project's scheme menu will show a stack trace. The project build setting for 'iOS Deployment Target' has to be set to 4.x (or older) to see older scheme targets.