美文网首页
ios-main使用

ios-main使用

作者: Roger_单 | 来源:发表于2015-12-22 09:23 被阅读43次
  • 跳转
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
  • view加颜色代码
    self.view.backgroundColor = [UIColor orangeColor];
  • 页面传值
    在新建页面.h中第一成员变量
@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];
  • 多个页面传值
    首先托个button 在Button下代码
    [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同上跳转唯一标实

相关文章

网友评论

      本文标题:ios-main使用

      本文链接:https://www.haomeiwen.com/subject/srnmhttx.html