您的位置:首页 > 产品设计 > UI/UE

在navgationController中添加UISegmentedControl

2015-08-19 19:19 423 查看
NSArray *segmentedArray = [NSArray arrayWithObjects:@"患者基本信息",@"患者信息",nil];

UISegmentedControl *segmentedControl = [[UISegmentedControl alloc]initWithItems:segmentedArray];

segmentedControl.backgroundColor = [UIColor clearColor];

segmentedControl.selectedSegmentIndex = 0;//设置默认选择项索引

// [segmentedControl setWidth:70.0 forSegmentAtIndex:2];//设置指定索引选项的宽度

[segmentedControl addTarget:self action:@selector(segmentAction) forControlEvents:UIControlEventValueChanged];

self.navigationItem.titleView = segmentedControl;

self.navigationItem.titleView.backgroundColor = [UIColor clearColor];

self.navigationItem.titleView.tintColor = [UIColor whiteColor];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: