`
niCe
  • 浏览: 40586 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

UINavigationBar + UISegmentedControl

 
阅读更多
//navigationBar通常只有左、右两个按钮,但可以
//通过添加UISegmentedControl来增加控制按钮
UINavigationBar* _navBar;
UISegmentedControl* _SegCtl; 
 
_navBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 40.0f)];
[_navBar showButtonsWithLeftTitle: @"Done" rightTitle:NULL leftBack: TRUE];
[_navBar setBarStyle: 3];
[_navBar enableAnimation];
[_navBar setDelegate: self];
 
_SegCtl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(80.0f, 8.0f, 230.0f, 30.0f) withStyle:2 withItems:NULL];
[_SegCtl insertSegment:0 withTitle:@"Button one" animated:FALSE];
[_SegCtl insertSegment:1 withTitle:@"Button two" animated:FALSE];
[_SegCtl insertSegment:2 withTitle:@"Button three" animated:FALSE];
[_SegCtl setDelegate:self];
[_navBar addSubview:_SegCtl];
NSLog(@"navigation items is: %@", [_navBar navigationItems]);

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics