iOS 5 : UIStepper Control
来源:互联网 发布:三大范式知乎 编辑:程序博客网 时间:2024/05/19 11:39
There is a new pre-built control in iOS 5 for incrementing or decrementing a value, UIStepper. The control has two buttons aligned horizontally, one labeled with a plus (+) the other a minus (-).
One nice feature is a continuous option, wherein if the user presses and holds down either +/- button, the stepper value is incremented repeatedly. The longer the button is held down, the faster the increment will occur. Also, you can have the increment value wrap around when a range of values is specified, for example, if you set min and max to 0 and 99 respectively, when the value reaches 99, the next value will be 0 (and vice-versa).
Below is a screenshot that shows the output of the example code below:
Below is a short code example showing the various properties available in UIStepper:
- // Create a label to show the value in the stepper
- label = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, 100, 30)];
- [label setTextColor:[UIColor whiteColor]];
- [label setBackgroundColor:[UIColor clearColor]];
- [label setTextAlignment:UITextAlignmentLeft];
- [label setText: @"Quantity:"];
- [[self view] addSubview:label];
- // Frame defines location, size values are ignored
- UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(120, 20,0, 0)];
- // Set action target and action for a particular value changed event
- [stepper addTarget:self action:@selector(stepperPressed:)forControlEvents:UIControlEventValueChanged];
- // Set min and max
- [stepper setMinimumValue:0];
- [stepper setMaximumValue:99];
- // Value wraps around from minimum to maximum
- [stepper setWraps:YES];
- // If continuos (default), changes are sent for each change in stepper,
- // otherwise, change event occurs once user lets up on button
- [stepper setContinuous:NO];
- // To change the increment value for each step
- // (default is 1)
- [stepper setStepValue:10];
- iOS 5 : UIStepper Control
- IOS UIStepper
- IOS UIStepper
- IOS--UIStepper的使用方法
- iOS UIStepper 加减计数器
- iOS UIStepper加减按钮
- ios学习--UIStepper
- iOS UIPageControl UIStepper使用方法
- iOS--UIStepper的使用方法详细
- Swift开发IOS-UIStepper
- ios学习笔记之-UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- 批处理中的字符串处理
- 常用设计思想
- ACE中TCP通信
- smart svn mac 安装注册加激活
- 带参数的构造器
- iOS 5 : UIStepper Control
- 用vs2005为sharepoint开发webpart步骤(最简单、自定义、通讯)
- 结合使用组合(composition)和继承(inheritance)
- 2013 CSU校队选拔赛(1) 部分题解
- android-universal-image-loader的使用
- 编解码学习笔记(二):codec类型
- Oracle Database Instance - Oracle 实例篇 5
- 确保正确清除
- 如何让TeeChart.Net自定义轴正常显示在图表区域