UISegmentControl 、UIStepper

  • UISegmentControl
1.    UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:@[@"1",@"2",@"3",@"4"]];
2.segmentControl.frame = (CGRect){50,100,100,50};

等同于

1.    UISegmentedControl *segmentControl = [[UISegmentedControl alloc]
2. initWithFrame:CGRectMake(50, 100, 100, 50)];
3.
4. [segmentControl insertSegmentWithTitle:@"1" atIndex:0 animated:YES];
5. [segmentControl insertSegmentWithTitle:@"2" atIndex:1 animated:YES];
6. [segmentControl insertSegmentWithTitle:@"3" atIndex:2 animated:YES];
7. [segmentControl insertSegmentWithTitle:@"4" atIndex:3 animated:YES];

其监听事件是值改变事件

1.    [segmentControl addTarget:self action:@selector(valueChange:)
2. forControlEvents:UIControlEventValueChanged];
1.-(void)valueChange:(UISegmentedControl *)sender{
2.
3. UIColor *red = [UIColor redColor];
4. UIColor *green = [UIColor purpleColor];
5. UIColor *purple = [UIColor greenColor];
6. UIColor *gray = [UIColor grayColor];
7.
8. NSArray *array = @[red,green,purple,gray];
9.
10. NSInteger index = sender.selectedSegmentIndex;
11. self.view.backgroundColor = array[index];
12.}

  • UIStepper

    • 简单了解一些属性

      1.@property(nonatomic) double value;                        // default is 0. sends UIControlEventValueChanged. clamped to min/max
      2.@property(nonatomic) double minimumValue; // default 0. must be less than maximumValue
      3.@property(nonatomic) double maximumValue; // default 100. must be greater than minimumValue
      4.@property(nonatomic) double stepValue; // default 1. must be greater than 0
      5.
 

UISegmentControl 、UIStepper的更多相关文章

  1. UIImageView、UISlider、UISwitch、UIStepper、UISegmentControl

    UIImageView——图像视图 作用:专门用来显示图片的控件 . 设置图像 [self.imageView setImage:[UIImage imageNamed:@"abc.png& ...

  2. UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController

    //UIActivityIndicatorView //小菊花,加载 #import "ActivityIndicatorVC.h" @interface ActivityIndi ...

  3. UI-不常用控件 UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController

    1 //UIActivityIndicatorView //小菊花,加载================================================================ ...

  4. iOS - UIStepper

    前言 NS_CLASS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED @interface UIStepper : UIControl @available(iOS 5.0 ...

  5. iOS - UI - UIStepper

    7.UIStepper //计数器控件   固定宽高 UIStepper * stepper = [[UIStepper alloc] initWithFrame:CGRectMake(100, 10 ...

  6. UIStepper更加详细的图文理解

    前言 UIStepper是一个微调器,该控件的外观和UISwitch相似,但该控件上包含了+,-两个按钮,共同用于控制某个值的增.减. 它继承了UIControl基类,默认属于活动控件,它可以与用户交 ...

  7. UI--普通控件总结1--控件使用

    本文目录 0.UIView常用的属性和操作 0_1.UIView常见的属性 0_2.UIView状态 0_3.UIView常用的方法 1.文本框UITextField和文本视图UITextView 1 ...

  8. iOS阶段学习第34天笔记(UI小组件 UISegment-UISlider-UIStepper-UIProgressView-UITextView介绍)

    iOS学习(UI)知识点整理 一.UI小组件 1.UISegmentedControl 分段选择器  实例代码 - (void)viewDidLoad { [super viewDidLoad]; / ...

  9. ReactiveCocoa基础知识内容

    本文记录一些关于学习ReactiveCocoa基础知识内容,对于ReactiveCocoa相关的概念如果不了解可以网上搜索:RACSignal有很多方法可以来订阅不同的事件类型,ReactiveCoc ...

随机推荐

  1. "Ray, Pass me the dishes!"

    uvaLive3938:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&pag ...

  2. 使用 getNextException() 来检索已经过批处理的特定元素的异常。 ERRORCODE=-4228, SQLSTATE=null

    今天查询了一天发现的问题,用ibatis做批量操作时,报错: [非原子批处理出现故障]使用 getNextException() 来检索已经过批处理的特定元素的异常. ERRORCODE=-4228, ...

  3. tomcat服务器报Server at localhost was unable to start within 45 seconds的问题

    今天在同一个tomcat服务器下部署了2个不同的应用程序,然后启动时报错:Server at localhost was unable to start within 45 seconds.If th ...

  4. JS实现点击按钮,自增输入框个数

    <html> <head> <script language="javascript"> var i=0; function addinput( ...

  5. 【HDOJ】1885 Key Task

    状态压缩+BFS,一次AC. /* 1885 */ #include <iostream> #include <queue> #include <cstring> ...

  6. Pots(bfs)

    Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8266   Accepted: 3507   Special Judge D ...

  7. ZOJ-2112-Dynamic Rankings(线段树套splay树)

    题意: 完成两个操作: 1.询问一个区间里第k小的数: 2.修改数列中一个数的值. 分析: 线段树套平衡树,线段树中的每个节点都有一棵平衡树,维护线段树所记录的这个区间的元素.这样处理空间上是O(nl ...

  8. gif动画问题

    iOS没有自带支持显示gif动画的功能,  用UIImageView的animationImage虽然可以实现图片动画, 当毕竟不方便. http://blog.stijnspijker.nl/200 ...

  9. AndroidStudio SVN检出

    版本管理是每个项目的必经之路,很多的ADT都会集成版本管理插件.AS也同样可以集成GITHUB和SVN插件.github对项目有一定的限制,而SVN就比较开放了,所以我们在用AS开发的时候一般用SVN ...

  10. Codeforces 715B & 716D Complete The Graph 【最短路】 (Codeforces Round #372 (Div. 2))

    B. Complete The Graph time limit per test 4 seconds memory limit per test 256 megabytes input standa ...