HMSegmentedControl
来源:互联网 发布:画电路板的软件 编辑:程序博客网 时间:2024/05/22 00:28
HMSegmentedControl 是 UISegmentedControl 的替代品,模仿了 Google Currents 使用的效果。
self.titleSegment = [[HMSegmentedControl alloc]initWithSectionTitles:@[@"title 1",@"title 2"]];
_titleSegment.frame = self.view.bounds;
_titleSegment.selectedSegmentIndex = 0;
_titleSegment.type = HMSegmentedControlTypeText;//风格样式
_titleSegment.font = [UIFont systemFontOfSize:17];
_titleSegment.selectionStyle =HMSegmentedControlSelectionStyleFullWidthStripe; // 选中样式
_titleSegment.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationNone;
_titleSegment.textColor = [UIColor colorWithHex:@"a5b1c1"];
_titleSegment.selectedTextColor = [UIColor colorWithHex:@"0064ab"];
_titleSegment.selectionIndicatorColor = [UIColor clearColor];
_titleSegment.backgroundColor = [UIColor clearColor];
// 添加点击事件
[_titleSegment setIndexChangeBlock:^(NSInteger index) {
NSLog(@"用户切换index == %d",(int)index);
switch (index) {
case 0:
// 第一个按钮
break;
case 1:
// 第二个按钮
break;
default:
break;
}
}];
[self.view addSubview:_titleSegment];
ps: segment选项中间的竖线 需要手动添加
- HMSegmentedControl
- HMSegmentedControl的使用
- 使用HMSegmentedControl实现分段控件
- HMSegmentedControl分段控制器的学习与使用
- codetyphone 5.5 自带的例程目录结构
- fastjson 格式化hibernate 级联属性 循环追踪问题
- Unity3d游戏场景优化杂谈
- Software Design Patterns on Android
- try catch finally 执行讲解
- HMSegmentedControl
- org.springframework.web.bind.MissingServletRequestParameterException: Required Long parameter 'label
- Quartz中时间参数说明 即Cron表达式
- an error has occured see the log file
- hdu5531 Rebuild
- 只要彼此爱过一次
- android EditText控件如何禁止输入内容
- PhpStorm快捷键
- multiple points