UIStepper控件详解
来源:互联网 发布:红旗linux系统 编辑:程序博客网 时间:2024/06/04 18:46
UIStepper继承自UIControl,它主要的事件是UIControlEventValueChanged,每当它的值改变了就会触发这个事件。
它主要有下面几个属性
1、value 当前所表示的值,默认0.0
2、minimumValue 最小可以表示的值,默认0.0
3、maximumValue 最大可以表示的值,默认100.0
4、stepValue 每次递增或递减的值,默认1.0
#import "AppDelegate.h"
UILabel *label;//设置全局变量
}
@end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
//创建label,实现数字变化,为方便使用,将label设置为全局变量
label.text = @"0";//初始值从0开始变化
//label.backgroundColor = [UIColor greenColor];
[self.window addSubview:label];
[label release];
UIStepper *stepper = [[UIStepper alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
stepper.minimumValue = 0;//最小值
stepper.maximumValue = 100;//最大值
stepper.stepValue = 100;//单次点击变化量
//为stepper关联一个方法,实现label的数值变化
[self.window addSubview:stepper];
[stepper release];
return YES;
}
-(void)change:(UIStepper *)stepper {
label.text = [NSString stringWithFormat:@"%.2lf", stepper.value];
}
@end
0 0
- UIStepper控件详解
- UIStepper控件的使用详解
- UI控件详解05-UIStepper控件详解
- iOS5新增内容之UIStepper控件详解
- iOS5新增内容之UIStepper控件详解
- UIStepper详解
- UIStepper音量调节控件
- UIStepper - 步进控件
- UI 数字输入控件UIStepper
- UIStepper (加减符号)(步进控件)
- 【IOS 开发】基本 UI 控件详解 (UIDatePicker | UIPickerView | UIStepper | UIWebView | UIToolBar )
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- UIStepper
- 初学python,模拟转账
- get、put、post、delete含义与区别
- android__常见布局
- Android接口回调,最简单的理解方式
- LeetCode 9_Palindrome Number
- UIStepper控件详解
- Python游戏引擎开发(二):创建窗口以及重绘界面
- Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks
- Spring DAO vs Spring ORM vs Spring JDBC
- 使用Maven
- 华为机试之含23数字排序输出
- 一个google面试的准备清单
- Android 开发日志——Handler引起内存泄漏
- android___测试Test