uisegmentedcontrol自定

2016/04/11 21:48
阅读数 40
 1 UIImage *segmentSelected = [[UIImage imageNamed:@"segcontrol_sel.png"] 2                                 resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; 3     UIImage *segmentUnSelected = [[UIImage imageNamed:@"segcontrol_uns.png"] 4                                   resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; 5     UIImage *segmentSelectedUnselected = [[UIImage imageNamed:@"segcontrol_sel-uns.png"] 6                                           resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; 7     UIImage *segmentUnSelectedSelected = [[UIImage imageNamed:@"segcontrol_uns-sel.png"] 8                                 resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; 9     UIImage *segmentUnSelectedUnSelected = [[UIImage imageNamed:@"segcontrol_uns-uns.png"]10                                 resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)];11     12     [self.seg setBackgroundImage:segmentUnSelected     // 非选中状态背景图13                         forState:UIControlStateNormal14                       barMetrics:UIBarMetricsDefault];15     [self.seg setBackgroundImage:segmentSelected        // 选中状态背景图16                         forState:UIControlStateSelected17                       barMetrics:UIBarMetricsDefault];18     19     [self.seg setDividerImage:segmentUnSelectedUnSelected   // 设置分割部分背景图,二侧都是非选中状态时20           forLeftSegmentState:UIControlStateNormal21             rightSegmentState:UIControlStateNormal22                    barMetrics:UIBarMetricsDefault];23     24     [self.seg setDividerImage:segmentSelectedUnselected    // 设置分割部分背景图,左边为选中状态,右边为非选中状态时25           forLeftSegmentState:UIControlStateSelected26             rightSegmentState:UIControlStateNormal27                    barMetrics:UIBarMetricsDefault];28     29     [self.seg setDividerImage:segmentUnSelectedSelected    // 设置分割部分背景图,左边为非选中状态,右边为选中状态30           forLeftSegmentState:UIControlStateNormal31             rightSegmentState:UIControlStateSelected32                    barMetrics:UIBarMetricsDefault];


展开阅读全文
打赏
1
0 收藏
分享
加载中
W浪琴B博主
http://www.cnblogs.com/wendingding/p/3868893.html 数据库
2016/04/19 23:31
回复
举报
W浪琴B博主
2016/04/13 21:40
回复
举报
W浪琴B博主
//添加点击事件 [segmented addTarget:self action:@selector(segmentedValueChanged:) forControlEvents:UIControlEventValueChanged]; //点击事件的实现 - (void)segmentedValueChanged:(UISegmentedControl *)sengder { ...
2016/04/11 21:51
回复
举报
更多评论
打赏
4 评论
0 收藏
1
分享
返回顶部
顶部