UIStepper
2015-07-04 08:18 甘雨路 阅读(165) 评论(0) 编辑 收藏 举报 1 #import "AppDelegate.h"
2
3 @interface AppDelegate ()
4
5 @end
6
7 @implementation AppDelegate
8
9
10 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
11 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
12 // Override point for customization after application launch.
13 self.window.backgroundColor = [UIColor whiteColor];
14
15 UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
16 stepper.minimumValue = 0;
17 stepper.maximumValue = 100;
18 stepper.value = 50;
19 [stepper addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
20
21 [self.window addSubview:stepper];
22 [self.window makeKeyAndVisible];
23 return YES;
24 }
25
26 - (void)valueChanged:(UIStepper *)sender
27 {
28 NSLog(@"Value = %.0f",sender.value);
29 }
30
31
32 @end