随着xibs,你可以调用不同的初始值:从xib移动到故事板时的封装?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Fetch Note...
// Initialize Edit Note View Controller with the fetched Note
EditNoteViewController *vc = [[EditNoteViewController alloc] initWithNote:note];
// Push View Controller onto Navigation Stack
[self.navigationController pushViewController:vc animated:YES];
}
这让我保持我的变量(在EditNoteViewController)私人和我也可以设置默认值,一些变量,例如中
- (id)initWithNote:(Note *)note {
// ....
if (self) {
self.note = note;
self.isEditing = YES;
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
//...
if (self) {
self.isEditing = NO;
}
return self;
}
我现在想用故事板的工作:
- 有设置从prepareForSegue变量不暴露变量或任何其他执行的好方法?
- 我该如何设置默认值?
请尽可能