ios-main使用

2015-12-22  本文已影响43人  Roger_单
Paste_Image.png Paste_Image.png

在view中选中 isIntial View Controlle


Paste_Image.png
Paste_Image.png

上代码

    [self performSegueWithIdentifier:@"slx" sender:self];

同时点击尖头,在identifler 写入唯一标实“slx”.

Paste_Image.png
    self.view.backgroundColor = [UIColor orangeColor];
@property(strong,nonatomic)NSString *qwe;

.m文件中 在viewDIdLoad中代码

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(_qwe);
}

再在第一页面上托个button,在button写入代码

 UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        slxViewController *vc = [sb instantiateViewControllerWithIdentifier:@"slxViewController"];
        vc.qwe = @"vc";
        [self.navigationController pushViewController:vc animated:YES];
    [self performSegueWithIdentifier:@"slx" sender:self];

另起个方法

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    
    if ([segue.identifier isEqualToString:@"slx"]) {
        
        slxViewController *vc = segue.destinationViewController;
        vc.qwe = @"888";
    }
}

slx同上跳转唯一标实

上一篇下一篇

猜你喜欢

热点阅读