UISegmentedControl和UIStepper的使用
UISegmentedControl:分栏控件,常用的属性和方法是
1.tintColor:控制分栏控件的颜色风格
2.insertSegmentWithTitle(Image):插入分栏标题(图片)
UIStepper:步进器,常用来控制数字的加减,常用的属性:
1.maximumValue:步进器支持的最大值
2.minimumValue:步进器支持的最小值
3.value:步进器的当前值
4.stepValue:步进器每一步的递进值
5.continous:是否支持长按时连续触发回调函数
6.autoRepeat:是否支持长按
7.tintColor:步进器的颜色风格
- (void) createUI {
int x = 10;
int width = [[UIScreen mainScreen] bounds].size.width - 20;
self.stepper = [[UIStepper alloc] initWithFrame:CGRectMake(x, 50, width, 50)];
//步进器的最大值
self.stepper.maximumValue = 100;
//步进器的最小值
self.stepper.minimumValue = 0;
//步进器单步的大小
self.stepper.stepValue = 10;
//步进器的当前值
self.stepper.value = 50;
//步进器长按时是否连续调用回调函数
self.stepper.continuous = YES;
//步进器是否支持长按
self.stepper.autorepeat = YES;
//步进器的颜色风格
self.stepper.tintColor = [UIColor redColor];
//步进器当前值发生变化时的回调
[self.stepper addTarget:self action:@selector(stepperChanged) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.stepper];
self.segCtrl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(x, 100, width, 40)];
//分栏控件填充数据(支持文字和图片)
[self.segCtrl insertSegmentWithTitle:@"今日头条" atIndex:0 animated:NO];
[self.segCtrl insertSegmentWithTitle:@"网易新闻" atIndex:1 animated:NO];
[self.segCtrl insertSegmentWithTitle:@"新浪微博" atIndex:2 animated:NO];
//分栏控件的颜色风格
self.segCtrl.tintColor = [UIColor redColor];
//分栏控件当前选中的栏
self.segCtrl.selectedSegmentIndex = 0;
//设置分栏控件选中栏发生变化时的回调
[self.segCtrl addTarget:self action:@selector(segCtrlChanged) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.segCtrl];
}
UISegmentedControl和UIStepper的使用的更多相关文章
- UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
//UIActivityIndicatorView //小菊花,加载 #import "ActivityIndicatorVC.h" @interface ActivityIndi ...
- UI-不常用控件 UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
1 //UIActivityIndicatorView //小菊花,加载================================================================ ...
- UIImageView、UISlider、UISwitch、UIStepper、UISegmentControl
UIImageView——图像视图 作用:专门用来显示图片的控件 . 设置图像 [self.imageView setImage:[UIImage imageNamed:@"abc.png& ...
- UISegmentControl 、UIStepper
UISegmentControl .UIStepper UISegmentControl 1. UISegmentedControl *segmentControl = [[UISegmentedCo ...
- iOS在导航栏上居中显示分段控件(UISegmentedControl)
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:nil]; segmentedCont ...
- 【UISegmentedControl】- 分段控件
一.初始化 二.常见的属性 1.segmentedControlStyle属性:设置基本的样式 2.momentary属性:设置在点击后是否恢复原样 . 3.numberOfSegments属性:只读 ...
- UI控件(UISegmentedControl)
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSArray* segmentArray = [[ ...
- UI第九节——UIStepper
- (void)viewDidLoad { [super viewDidLoad]; // 实例化UIStepper,大小是固定的 UIStepper *stepper = ...
- UI第八节——UISegmentedControl
- (void)viewDidLoad { [super viewDidLoad]; NSArray *items = @[@"消息", @"电话" ...
随机推荐
- 关于docker容器是怎样建立新的namespace的。
最近博客收到了一封交流的私信,感谢您的关注:现在就我理解的docker建立容器时namespace的建立问题做一个 个人的回答: 一,从原理角度来讲: docker创建container,说白了就是l ...
- SharePoint 2013 中的 PowerPoint Automation Services
简介 许多大型和小型企业都将其 Microsoft SharePoint Server 库用作 Microsoft PowerPoint 演示文稿的存储库.所有这些企业在 ...
- Qt5 主窗口组成
1. 菜单栏 菜单是一系列命令的列表.为了实现菜单.工具栏按钮.键盘快捷键等命令的一致性,Qt使用动作(Action)来表示这些命令.Qt的菜单就是由一系列的QAction动作对象构成的列表,而菜单栏 ...
- 7.2.3 使用RenderTargetBitmap类生成图片
RenderTargetBitmap类可以将可视化对象转换为位图,也就是说它可以将任意的UIElement以位图的形式呈现.那么我们在实际的编程中通常会利用RenderTargetBitmap类来对U ...
- UCanCode发布升级E-Form++可视化源码组件库2014 全新版 (V20.01)!
UCanCode发布升级E-Form++可视化源码组件库2014 全新版 (V20.01)! --- UCanCode有史以来最强大的版本发布! E-Form++可视化源码组件库企业版本2014最新版 ...
- UE4 代码编写细节:静态变量
Note:因为在切换关切时,会GC掉所有GameThread线程下的Object类,如果Static是UOBject 请调用AddToRoot函数 当然如果你的UObject子类Object是在自己 ...
- Ubuntu 16.04 软件中心闪退 解决方案
最近使用16.04不知道是哪里出了问题,软件中心打不开了,点击图标之后完全不显示GUI,过一会儿软件就自动关闭了,然后也没有报错的log. 虽然可以使用命令行升级,但是强迫症不能忍啊. 经过一番折腾, ...
- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path 解决办法
返回数据解析错误 com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT ...
- Yii框架(Yii Framework)部署
一.下载Yii 在部署yii框架之前首先要搭建好php环境,这里就不说搭建环境的问题了(这里已经部署好wampserver了),环境搭建好后,到yii官方网站下载yii framework:http: ...
- 联合(union)类型有哪些使用场景
2013-08-22 - 18:17:50 by Gold_Lion 今天突然碰到“联合”这个数据类型了,平时用的不多,实在也想不出来它到底能帮我干嘛?于是google了一下,终于有一个是利用联合( ...