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的使用的更多相关文章

  1. UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController

    //UIActivityIndicatorView //小菊花,加载 #import "ActivityIndicatorVC.h" @interface ActivityIndi ...

  2. UI-不常用控件 UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController

    1 //UIActivityIndicatorView //小菊花,加载================================================================ ...

  3. UIImageView、UISlider、UISwitch、UIStepper、UISegmentControl

    UIImageView——图像视图 作用:专门用来显示图片的控件 . 设置图像 [self.imageView setImage:[UIImage imageNamed:@"abc.png& ...

  4. UISegmentControl 、UIStepper

    UISegmentControl .UIStepper UISegmentControl 1. UISegmentedControl *segmentControl = [[UISegmentedCo ...

  5. iOS在导航栏上居中显示分段控件(UISegmentedControl)

    UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:nil]; segmentedCont ...

  6. 【UISegmentedControl】-  分段控件

    一.初始化 二.常见的属性 1.segmentedControlStyle属性:设置基本的样式 2.momentary属性:设置在点击后是否恢复原样 . 3.numberOfSegments属性:只读 ...

  7. UI控件(UISegmentedControl)

    @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSArray* segmentArray = [[ ...

  8. UI第九节——UIStepper

    - (void)viewDidLoad {    [super viewDidLoad];        // 实例化UIStepper,大小是固定的    UIStepper *stepper = ...

  9. UI第八节——UISegmentedControl

    - (void)viewDidLoad {    [super viewDidLoad];    NSArray *items = @[@"消息", @"电话" ...

随机推荐

  1. Amazon AWS 架设EC2服务器(datizi)fanqiang (更新手机VPN/L2TP设置)

    今天用AWS在东京架设了一台服务器用来个人fanqiang.为什么用AWS呢,阿里云学生价9.9可以搭在香港,但是我的学制今年2月份在学信网上就到期了,腾讯云holy shit,我司AZURE据说员工 ...

  2. TypeScript 中的 "=>" 真的很好用!!!

    class funs { public $scope: IBarPadScope; constructor($scope: IBarPadScope) { this.$scope = $scope; ...

  3. JSP自定义标签

    在JSP网页编程中,我们通常不满足于jstl或其他的框架,我们也可以自己写属于自己专用的标签. 在这里介绍一下表格中展示JavaBean的自定义标签的使用 第一步:写一个父标签,用来显示获取数据 新建 ...

  4. display:none与visibility:hidden区别

    display:none与visibility:hidden有一个共同的作用是隐藏要显示的内容isplay:none 隐藏,但是不占空间 “看不见摸不到” 加载 display:none 隐藏,但是不 ...

  5. word常用操作

    [Word2003文档添加个行号] 参考:http://jingyan.baidu.com/article/e9fb46e1ca1d3c7520f7666f.html#333225-tsina-1-5 ...

  6. C++注意事项

    1.static和const不能同时修饰类的成员函数(static int getde()const;) 分析:原因在于const会在函数中添加一个隐式参数const this*,而static是没有 ...

  7. 第五章 搭建 S3C6.410 开发板的 测试环境

    一.简介: 对于嵌入式驱动开发者来说,你必须要了解什么是开发板:它与我们经常用的手机类似, 包含了显示屏. 键盘. Wi-Fi. 蓝牙等模块等,是开发者必备的硬件设备.但与手机不同的是:在开发板上安装 ...

  8. bootstrap-datetime 的使用

    bootstrap-datetime js的下载 http://pan.baidu.com/s/1eQnE5dK html的代码 <div class="input-group dat ...

  9. web安全之ssrf

    ssrf(服务器端请求伪造)原理: 攻击者构造形成由服务端发起请求的一个漏洞.把服务端当作跳板来攻击其他服务,SSRF的攻击目标一般是外网无法访问到的内网 当服务端提供了从其他服务器获取数据的功能(如 ...

  10. Java EE-Eclipse 运行Jsp项目遇到的几个问题及解决方法

    1.导入sql包错误 解决办法: 点击项目右击Properties->Java Build Path —> Libraries—>JRE System Library –> E ...