标签:
NSArray *arry=@[@"first",@"第二",@"3nn"];
//self.segment=[[UISegmentedControl alloc]initWithFrame:CGRectMake(200, 200, 100, 100)];
self.segment=[[UISegmentedControl alloc]initWithItems:arry];
// 设置成YES,点击后,颜色闪一次,之后不会变
self.segment.momentary=NO;
[self.segment addTarget:self action:@selector(mpp) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.segment];
}
-(void)moo{
NSLog(@"%lu",self.segment.numberOfSegments);
self.segment.tintColor=[UIColor redColor];
NSLog(@"%lu",self.segment.selectedSegmentIndex);
[self.segment insertSegmentWithTitle:@"呵呵" atIndex:1 animated:YES];
[self.segment removeSegmentAtIndex:0 animated:YES];
NSLog(@"%@",[self.segment titleForSegmentAtIndex:2]);
self.stepper=[[UIStepper alloc]initWithFrame:CGRectMake(20, 20, 100, 30)];
self.stepper.minimumValue=1;
self.stepper.maximumValue=20;
self.stepper.stepValue=1;// 步进值,每次点击变化1
// YES 点击控件不松开方法一直执行NSLog有输出,NO 点击不松开方法一直执行,但是NSLog不输出
// self.stepper.continuous=YES;
self.stepper.autorepeat=NO; // YES 点击控件不松开方法一直在执行,NSLog有输出.NO 点击不松开方法治执行一次,//点击一次执行一次。
[self.stepper setBackgroundImage:[UIImage imageNamed:@"Red1 Circle"] forState:UIControlStateNormal];
}
标签:
原文地址:http://www.cnblogs.com/lanyisanqqi/p/5092672.html