NSDictionary
只能存放OBJECT
.
// 透過KEY去取值
NSString *BlueString = [myDictionary objectForKey:@"ocean color"];
NSNumber
NSNumber *number = [NSNumber numberWithInt:5];
NSLog(@"%@", number); //5
上述範例也等於 @5
. This is a shorthand for creating a NSNumber object.
define
#define PLANET_NAME @"Planet Name"
PLANET_NAME : @"Mercury"
Literals
Class Method
曾經遇到的問題:
‘NSInternalInconsistencyException’, reason: ‘-[UITableViewController loadView] loaded the “vXZ-lx-hvc-view-kh9-bI-dsS” nib but didn’t get a UITableView.’
解法:changing your
@interface SearchViewController : UITableViewController to @interface SearchViewController : UIViewController
Dismissing ViewControllers
When Using a push segue, we can use the method popViewController if have multiple ViewControllers.
And if we have a modal segue, that can pop or remove a single ViewController from our stack by using the method dismissViewController.
[self dismissViewControllerAnimated:YES completion:nil]`;
[self.navigationController popViewControllerAnimated:YES];
參考資料:
1. http://stackoverflow.com/questions/20234875/loaded-the-nib-but-didnt-get-a-uitableview?lq=1
2. http://www.slideshare.net/sysheen/ios-25194974 (初學者教學)
沒有留言:
張貼留言