UISegmentControl 、UIStepper
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的更多相关文章
- UIImageView、UISlider、UISwitch、UIStepper、UISegmentControl
UIImageView——图像视图 作用:专门用来显示图片的控件 . 设置图像 [self.imageView setImage:[UIImage imageNamed:@"abc.png& ...
- UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
//UIActivityIndicatorView //小菊花,加载 #import "ActivityIndicatorVC.h" @interface ActivityIndi ...
- UI-不常用控件 UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
1 //UIActivityIndicatorView //小菊花,加载================================================================ ...
- iOS - UIStepper
前言 NS_CLASS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED @interface UIStepper : UIControl @available(iOS 5.0 ...
- iOS - UI - UIStepper
7.UIStepper //计数器控件 固定宽高 UIStepper * stepper = [[UIStepper alloc] initWithFrame:CGRectMake(100, 10 ...
- UIStepper更加详细的图文理解
前言 UIStepper是一个微调器,该控件的外观和UISwitch相似,但该控件上包含了+,-两个按钮,共同用于控制某个值的增.减. 它继承了UIControl基类,默认属于活动控件,它可以与用户交 ...
- UI--普通控件总结1--控件使用
本文目录 0.UIView常用的属性和操作 0_1.UIView常见的属性 0_2.UIView状态 0_3.UIView常用的方法 1.文本框UITextField和文本视图UITextView 1 ...
- iOS阶段学习第34天笔记(UI小组件 UISegment-UISlider-UIStepper-UIProgressView-UITextView介绍)
iOS学习(UI)知识点整理 一.UI小组件 1.UISegmentedControl 分段选择器 实例代码 - (void)viewDidLoad { [super viewDidLoad]; / ...
- ReactiveCocoa基础知识内容
本文记录一些关于学习ReactiveCocoa基础知识内容,对于ReactiveCocoa相关的概念如果不了解可以网上搜索:RACSignal有很多方法可以来订阅不同的事件类型,ReactiveCoc ...
随机推荐
- Jump
hdu4862:http://acm.hdu.edu.cn/showproblem.php?pid=4862 题意:给你n*m的方格,每个方格中有一个数(0---9),然后你每次可以选择一个点开始,这 ...
- 为Ubuntu配置ssh服务 方便远程登陆
Ubuntu系统必须开启ssh服务后,XP或者其他的主机才可以远程登陆到Ubuntu系统. 1,安装软件包,执行sudo apt-get install openssh-server Ubuntu缺省 ...
- 【HDOJ】2451 Simple Addition Expression
递推,但是要注意细节.题目的意思,就是求s(x) = i+(i+1)+(i+2),i<n.该表达中计算过程中CA恒为0(包括中间值)的情况.根据所求可推得.1-10: 31-100: 3*41- ...
- bzoj3744
这道题是目前我做bzoj最感动的一题没有之一……首先先警示一下,分块的题目能不套主席树尽量不套因为主席树不仅回答来一个log而且常数也比较大,对于分块这种根号的算法非常不适合这里是求区间逆序对,考虑查 ...
- 数据结构(树链剖分):BZOJ 4034: [HAOI2015]T2
Description 有一棵点数为 N 的树,以点 1 为根,且树点有边权.然后有 M 个 操作,分为三种: 操作 1 :把某个节点 x 的点权增加 a . 操作 2 :把某个节点 x 为根的子树中 ...
- 使用DateAdd方法向指定日期添加一段时间间隔,使用TimeSpan对象获取时间间隔
一:使用DateAdd方法向指定日期添加一段时间间隔,截图 二:代码 using System; using System.Collections.Generic; using System.Comp ...
- foxmail邮箱在代理环境下不能使用解决方法。
由于工作原因,在域环境中但是还不是域用户,怎么设置代理也不能使用邮件客户端,幸亏老大给一软件,如下图 安装超级简单,而且软件很小,安装完后重启,基本不用设置就可以使用,前提是你的邮箱客户端要设置代理服 ...
- CodeForces 591B
题目链接: http://codeforces.com/problemset/problem/591/B 题意: 给你一串字符串,字符串里的字符全是a-z的小写字母,下面的m行,是字符串的交换方式, ...
- [AS/400] Control Language
下面是一个简单的 CL 例子,转换日期格式:从 Julian 到 MDY,或者反方向转换. 接受两个参数,日期值 IN,目标类型 TYP,将转换后的日期值存入 OUT 中. PGM (&IN ...
- 80X86 分段机制(读书笔记)
GDT(全局描述符表)本身并不是一个段,而是线性地址空间的一个数据结构.GDT的线性地址和长度必须加载进GDTR寄存器中.LDT(局部描述符表)存放在LDT类型的系统段中.此时GDT必须含有LDT的段 ...