1.设置初始view
2.给viewController设置navagatoion
3.Segue 使用之弹出view
A---->B
a.右击A上边的某按钮拖动到B上在弹出的框种选择Modal(模态转换)
b.给模态转换命名:
dissmiss B
a.B 设置Done 按钮
b.B中添加代理方法
@class B;
@protocol BViewControllerDelegate <NSObject>
- (void)BDidSave:(B *)controller;
@end
c.B中添加Done按钮的IBAction方法:
- (IBAction)done:(id)sender;
d.在StoryBoard中Done按钮右击拖动到,选择Done的IBAction方法。
e.在B的.m中实现
- (IBAction)done:(id)sender
{
[self.delegate BDidSave:self];
}
f.在A.h中中声明B代理
@interface A : UITableViewController<BViewControllerDelegate>
g.在A.m中实现代理方法
- (void)BDidSave:(B *)controller
{
[self dismissViewControllerAnimated:YES completion:nil];
}
h.在A.m中实现
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"AddPlayer"])
{
UINavigationController *navigationController =
segue.destinationViewController;
B
*b =
[[navigationController viewControllers]
objectAtIndex:0];
b.delegate = self;
}
}