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 = @[@"消息", @"电话" ...
随机推荐
- 第一章:Android系统移植与驱动开发概述
Android是基于Linux内核的,与Linux内核没有太大的区别,只是增加了一些自己独有的驱动,随着Android发布版本的不断升级,他所使用的Linux内核也在不断升级,以适应新的安卓版本,为他 ...
- PAT 1072. Gas Station (30)
A gas station has to be built at such a location that the minimum distance between the station and a ...
- Ruby中字符串与正则表达式的问题
Ruby的正则表达式为Regexp类的对象 主要的元语言字符 記号 意味 例 説明 ^ 行頭 /^abc/ abcで始まる行 $ 行末 /abc$/ abcで終わる行 . 任意の1文字 /a.b/ a ...
- java mail使用qq邮箱发邮件的配置方法
最近自己折腾了下Java中利用mai发送QQ邮件 1.QQ邮箱设置 1.1 进去QQ邮箱-->设置-->账号-->进行设置如下图 2.foxmail设置(由于我要利用它收邮件) 2. ...
- 使用递归方法遍历TreeView的节点如配置则勾选
自己在网上找了一段时间都没有找到取自数据库的值与TreeView中的节点值进行对比如匹配则勾选中CheckBox的资料,后面自己写了一个递归方法实现,现在记录起来以备需要时使用.在没写这递归方法前如果 ...
- powerdesigner 生成mysql PDM 的COMMENT注释
1powerdesigner 生成mysql PDM 的COMMENT注释 默认的pd没有生成注释,针对mysql5.0可以如下修改.在Database-->edit Current DBMS. ...
- C++ 容器 LIST VECTOR erase
在Vector中 做erase操作就是按照下面的步骤来做的: copy() destory(); 在list容器中 erase操作 destory() deallocate() Vector使用从某 ...
- C++ 类知识点
1. member function definitions are processed after the compiler processes all of the declarations in ...
- stunnel-server
#!/bin/bash # need to be run as root ]]; then echo "must to be run as root" exit fi # givi ...
- Android 性能测试
写在前面: 测试一道,博主接触的也是皮毛而已,没有接触过rom的测试,下边所说的都是博主接触过的app的性能测试.我只谈方法,少提概念.各位大神不喜勿喷. 概述 除启动时间外,我们应该做的测试,可能需 ...