`
chenmodeyu126
  • 浏览: 6591 次
  • 性别: Icon_minigender_1
  • 来自: 南京
最近访客 更多访客>>
社区版块
存档分类
最新评论

UISegmentedController的使用(个人记录)

    博客分类:
  • IOS
 
阅读更多

1.首先在相应的xib文件中添加Segmented Control控件



 

效果如下:


 

2.对三组控件进行连线:

@property (retain, nonatomic) IBOutlet UISegmentedControl *segmentedHkfs;

@property (retain, nonatomic) IBOutlet UISegmentedControl *segmentedDklb;

@property (retain, nonatomic) IBOutlet UISegmentedControl *segmentedJsfs;

 

3.然后对这三组控件进行数据初始化

[_segmentedHkfs removeAllSegments];
    [_segmentedHkfs insertSegmentWithTitle:@"等额本息" atIndex:0 animated:YES];
    [_segmentedHkfs insertSegmentWithTitle:@"等额本金" atIndex:1 animated:YES];
    //设置默认选项
    _segmentedHkfs.selectedSegmentIndex = 0;

 

[_segmentedDklb removeAllSegments];
    [_segmentedDklb insertSegmentWithTitle:@"商业贷款" atIndex:0 animated:YES];
    [_segmentedDklb insertSegmentWithTitle:@"公积金贷款" atIndex:1 animated:YES];
    [_segmentedDklb insertSegmentWithTitle:@"组合贷款" atIndex:2 animated:YES];
    //设置默认选项
    _segmentedDklb.selectedSegmentIndex = 0;

 

[_segmentedJsfs removeAllSegments];
    [_segmentedJsfs insertSegmentWithTitle:@"面积单价" atIndex:0 animated:YES];
    [_segmentedJsfs insertSegmentWithTitle:@"贷款总额" atIndex:1 animated:YES];
    //设置默认选项
    _segmentedJsfs.selectedSegmentIndex = 1;

 

效果如下:



 

 

  • 大小: 23.7 KB
  • 大小: 34 KB
  • 大小: 18.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics