YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

2015-12-16 UI7_UINavigationController

//
// RootViewController.m
// UI7_UINavigationController
//
// Created by YIem on 15/12/15.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

// self.navigationItem.title = @"标题";


//****< 导航标题视图 >****
UISegmentedControl *seg = [[UISegmentedControl alloc]initWithItems:@[@"电话", @"聊天"]];
seg.frame = CGRectMake(100, 100, 120, 30);
// 默认选中
seg.selectedSegmentIndex = 0;
// 添加到导航栏中间
self.navigationItem.titleView = seg;
[seg release];
//******< 导航栏按钮>****
// 左按钮

// self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(left:)];

// 自定义 左按钮
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"2"]style:UIBarButtonItemStylePlain target:self action:@selector(left:)] autorelease];
// 右按钮
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"1"] style:UIBarButtonItemStylePlain target:self action:@selector(right:)]autorelease];

// self.navigationItem.rightBarButtonItems = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@""] style: target:self action:@selector(right:)] autorelease];


// 按钮对象
UIBarButtonItem *item1 =[[[UIBarButtonItem alloc]
  initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self
  action:@selector(leftAction)] autorelease];
UIBarButtonItem *item2 =[[[UIBarButtonItem alloc]
  initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self
  action:@selector(leftAction)] autorelease];
// 左按钮数组
self.navigationItem.leftBarButtonItems = @[item1, item2];
// 右按钮数组
self.navigationItem.rightBarButtonItems= @[item1,item2];


///******<  item颜色>****
self.navigationController.navigationBar.tintColor = [UIColor blackColor];





}

{

NSLog(@"%@", btn);

}

/*

pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation

*/

@end

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »