2011年1月2日星期日

UIViewController loadView

When alloc a UIViewController with nib name, it does not load the view yet, so we need to call loadView to load its view.

Such as

_playStationController = [[PlayStationViewController alloc] initWithNibName:@"PlayStationViewController"
bundle:nil];
[_playStationController loadView];

Otherwise when access the IBOutlet in the view, it may returns nil

Create a new git repository for your iphone project

Here is how I create a repository for my iphone project.
  1. After create a project in xcode, open a terminal and go to the project directory
  2. type "git init", it should create an empty .git repository
  3. create a .gitignore file, the file has following contents
# xcode noise
build/*
*.pbxuser
*.mode1v3

# old skool
.svn

# osx noise
.DS_Store
profile
4. Create a .gitattributes file
*.pbxproj -crlf -diff -merge

5. type "git add ." to add all files in repository
6. type "git commit -m 'initail commit'" to commit all changes.


Now your repository is ready!

BTW: I should learn how to use this blog :(

reference: http://shanesbrain.net/2008/7/9/using-xcode-with-git