`
zl4393753
  • 浏览: 333109 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

Navigationbar With Segmented Button

阅读更多
实现带Segmented Button的Navigationbar:
NSArray *itemArray = [NSArray arrayWithObjects: @"All", @"Some", nil];
chooseAllORSome = [[UISegmentedControl alloc] initWithItems:itemArray];
chooseAllORSome = CGRectMake(0,0,150, 32);
chooseAllORSome.segmentedControlStyle = UISegmentedControlStyleBar;
chooseAllORSome.selectedSegmentIndex = 0;
[chooseAllORSome addTarget:self action:@selector(pickOne:)  forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView: chooseAllORSome];
self.navigationItem.rightBarButtonItem = segmentBarItem;
self.navigationItem.title = @"Hello";
[segmentBarItem release];

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics