iosui学习中的课堂笔记 UISegmentedControl。UISlider。UIStepper。UISwitch。
来源:互联网 发布:青岛邮箱数据 编辑:程序博客网 时间:2024/06/04 19:09
#import "MainViewController.h"@interface MainViewController ()@end@implementation MainViewController- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self;}- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. // 1.分段控件(UISegmentedControl) UISegmentedControl *segmented = [[UISegmentedControl alloc]initWithItems:@[@"伊泽瑞尔", @"德邦总管", @"嘉文四世"]]; //给segmentedControl绑定方法 [segmented addTarget:self action:@selector(segmentedAction:) forControlEvents:UIControlEventValueChanged]; //改变segmented的颜色 [segmented setTintColor:[UIColor grayColor]]; [self.view addSubview:segmented]; //滑动控件 UISlider *slider = [[UISlider alloc]initWithFrame:CGRectMake(20, 470, 260, 40)]; [self.view addSubview:slider]; [slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged]; [slider release]; //设置silder 的最大值/最小值 [slider setMaximumValue:100]; [slider setMinimumValue:0]; //利用UIImageView播放Gif图片 UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(50, 200, 200, 200)]; // [imageView setBackgroundColor:[UIColor yellowColor]]; [self.view addSubview:imageView]; [imageView release]; //产生一组图片 NSMutableArray *imageArray = [NSMutableArray array]; for (int i = 0; i < 22; i++) { //按顺序产生数组 UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"Zombie%d.tiff", i + 1]]; //把图片添加到数组中 [imageArray addObject:image]; } //将图片数组给imageView等待播放 imageView.animationImages = imageArray; //播放速度 imageView.animationDuration = 0.00001;//播放一遍所需要的时间 //播放次数 imageView.animationRepeatCount = 0; //播放 [imageView startAnimating]; //播放次数 UIStepper *stepper = [[UIStepper alloc]initWithFrame:CGRectMake(220, 220, 120, 40)]; [stepper addTarget:self action:@selector(stepperAction:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:stepper]; [stepper setMaximumValue:100]; [stepper setMinimumValue:0]; [stepper release]; UISwitch *swich = [[UISwitch alloc]initWithFrame:CGRectMake(20, 220, 120, 40)]; [swich addTarget:self action:@selector(swichAction:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:swich]; [swich release]; //设置背景图片 //[segmented setBackgroundImage:[UIImage imageNamed:@"伊泽.jpg"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; segmented.frame = CGRectMake(20, 40, 280, 40); [segmented release];}- (void)swichAction:(UISwitch *)swich{ NSLog(@"关/开");}- (void)stepperAction:(UIStepper *)stepper{ NSLog(@"增/减"); NSLog(@"增/减%f", stepper.value);}- (void)sliderAction:(UISlider *)slider{ //slider.value 当前滑动到得值 NSLog(@"滑动%f", slider.value); NSLog(@"滑动");}- (void)segmentedAction:(UISegmentedControl *)seg{ //通过点击下标判断 if (seg.selectedSegmentIndex == 0) { NSLog(@"是时候表演真正的技术了"); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://15542470822"]];//打电话 发短信 打开网页 发邮件等 } if (seg.selectedSegmentIndex == 1) { NSLog(@"这就是我德邦总管赵兴"); } if (seg.selectedSegmentIndex == 2) NSLog(@"德玛西亚"); //插入一个分段 // [seg insertSegmentWithTitle:@"皮城女警" atIndex:0 animated:YES];}- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}/*#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller.}*/@end
0 0
- iosui学习中的课堂笔记 UISegmentedControl。UISlider。UIStepper。UISwitch。
- UISegmentedControl ,UIStepper,UISwitch,UISlider综合应用(实例需求)
- UISegmentedControl,UISlider,UISwitch,代码截屏,UIStepper的简单使用
- UISwitch、UISlider、UISegmentedControl、UIActivityIndicatorView、UIStepper、UIProgress、UIAlertView--(图)
- UISegmentedControll,UISlider,UISwitch,UIStepper
- 【学习ios之路:UI系列】ios中常见的几种控件.(UISlider,UISwitch,UIStepper,UISegmentedControl)
- 【学习ios之路:UI系列】ios中常见的几种控件.(UISlider,UISwitch,UIStepper,UISegmentedControl)
- 【学习ios之路:UI系列】ios中常见的几种控件.(UISlider,UISwitch,UIStepper,UISegmentedControl)
- UISegmentedControl、UISwitch、UISlider
- OC-UIAlertController& UIStepper& UISlider& UISwitch
- 【iOS学习笔记】代码实现常用控件UIButton、UISlider、UISwitch、UISegmentedControl
- UI - UISegmentedControl、UISlider、UIImageView、UISwitch
- UIButton、UITextField、UISlider、UISwitch、UISegmentedControl
- UISlider、UIStepper、UISegmentControl、UISwitch、UIProgressView、UIActivityIndicatorView
- iOS开发-Day27UISwitch&UISlider&UIStepper&UISegmentedControl
- UI控件笔记(八):UI之UISlider\UIStepper\ UIProgressView\ UITextView\UISwitch\ UIActivityIndicatorView\ UISeg
- UISlider/UISegmentedControl/UISetpper/UISwitch/UIProgressView/UIPageControl
- 分段选择控件UISegmentedControl、UISwitch、UISlider
- 揭秘腾讯大数据之平台综述篇
- 静态数据管理类定义(单例模式)
- oracle 利用存储过程为表动态建立索引
- Swift 之 枚举
- MyEclipse8.5快捷键总结(持续更新)
- iosui学习中的课堂笔记 UISegmentedControl。UISlider。UIStepper。UISwitch。
- Leetcode Reverse Words in a String
- mahout算法源码分析之Itembased Collaborative Filtering(六)总结
- 随机数是骗人的,.Net、Java、C为我作证
- 分布式消息系统Kafka初步
- Java线程阻塞中断和LockSupport的常见问题
- js全角字符转为半角大写
- QFile 总结
- Java_DOM解析XML