美文网首页
iOS 开发怎样在导航条上添加多个item

iOS 开发怎样在导航条上添加多个item

作者: 黑夜漫步 | 来源:发表于2016-06-16 14:47 被阅读2322次
    //为导航栏添加右侧按钮1
    UIBarButtonItem *right1 = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"more"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(rightAction:)];
    
    //为导航栏添加右侧按钮2
    UIBarButtonItem *right2 = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"more"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(rightAction:)];
     
    NSArray *arr = [[NSArrayalloc]initWithObjects:right1, right2, nil];
    
    self.navigationItem.rightBarButtonItems = arr;
    

    相关文章

      网友评论

          本文标题:iOS 开发怎样在导航条上添加多个item

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