UISegmentedControl和UIStepper的使用
UISegmentedControl:分栏控件,常用的属性和方法是
1.tintColor:控制分栏控件的颜色风格
2.insertSegmentWithTitle(Image):插入分栏标题(图片)
UIStepper:步进器,常用来控制数字的加减,常用的属性:
1.maximumValue:步进器支持的最大值
2.minimumValue:步进器支持的最小值
3.value:步进器的当前值
4.stepValue:步进器每一步的递进值
5.continous:是否支持长按时连续触发回调函数
6.autoRepeat:是否支持长按
7.tintColor:步进器的颜色风格
- (void) createUI {
int x = 10;
int width = [[UIScreen mainScreen] bounds].size.width - 20;
self.stepper = [[UIStepper alloc] initWithFrame:CGRectMake(x, 50, width, 50)];
//步进器的最大值
self.stepper.maximumValue = 100;
//步进器的最小值
self.stepper.minimumValue = 0;
//步进器单步的大小
self.stepper.stepValue = 10;
//步进器的当前值
self.stepper.value = 50;
//步进器长按时是否连续调用回调函数
self.stepper.continuous = YES;
//步进器是否支持长按
self.stepper.autorepeat = YES;
//步进器的颜色风格
self.stepper.tintColor = [UIColor redColor];
//步进器当前值发生变化时的回调
[self.stepper addTarget:self action:@selector(stepperChanged) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.stepper];
self.segCtrl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(x, 100, width, 40)];
//分栏控件填充数据(支持文字和图片)
[self.segCtrl insertSegmentWithTitle:@"今日头条" atIndex:0 animated:NO];
[self.segCtrl insertSegmentWithTitle:@"网易新闻" atIndex:1 animated:NO];
[self.segCtrl insertSegmentWithTitle:@"新浪微博" atIndex:2 animated:NO];
//分栏控件的颜色风格
self.segCtrl.tintColor = [UIColor redColor];
//分栏控件当前选中的栏
self.segCtrl.selectedSegmentIndex = 0;
//设置分栏控件选中栏发生变化时的回调
[self.segCtrl addTarget:self action:@selector(segCtrlChanged) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.segCtrl];
}
UISegmentedControl和UIStepper的使用的更多相关文章
- UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
//UIActivityIndicatorView //小菊花,加载 #import "ActivityIndicatorVC.h" @interface ActivityIndi ...
- UI-不常用控件 UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
1 //UIActivityIndicatorView //小菊花,加载================================================================ ...
- UIImageView、UISlider、UISwitch、UIStepper、UISegmentControl
UIImageView——图像视图 作用:专门用来显示图片的控件 . 设置图像 [self.imageView setImage:[UIImage imageNamed:@"abc.png& ...
- UISegmentControl 、UIStepper
UISegmentControl .UIStepper UISegmentControl 1. UISegmentedControl *segmentControl = [[UISegmentedCo ...
- iOS在导航栏上居中显示分段控件(UISegmentedControl)
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:nil]; segmentedCont ...
- 【UISegmentedControl】- 分段控件
一.初始化 二.常见的属性 1.segmentedControlStyle属性:设置基本的样式 2.momentary属性:设置在点击后是否恢复原样 . 3.numberOfSegments属性:只读 ...
- UI控件(UISegmentedControl)
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSArray* segmentArray = [[ ...
- UI第九节——UIStepper
- (void)viewDidLoad { [super viewDidLoad]; // 实例化UIStepper,大小是固定的 UIStepper *stepper = ...
- UI第八节——UISegmentedControl
- (void)viewDidLoad { [super viewDidLoad]; NSArray *items = @[@"消息", @"电话" ...
随机推荐
- Three.js typescript definitely typed 文件
最近学习three.js,想用typescript编写代码,去http://definitelytyped.org/找了一圈没有发现three.js的definitely typed文件. 好吧,花了 ...
- C#利用摄像头拍照功能实现
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 【转】Sqlite 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该...
开发环境: vs2010+.net framework 4.0+ System.Data.SQLite.DLL (2.0)今天在做Sqlite数据库测试,一运行程序在一处方法调用时报出了一个异常 混合 ...
- AXUre
[ Javascript ] 一.javascript能用来干什么? 1.数据的验证. 2.对动态这本写到网页当中. 3.可以对事件做出响应. 4.可以读写html 中的内室. 5.可以检测浏览器 6 ...
- NOIP 考前DP 复习
POJ 2533 最长不降子序列 #include <cstdio> ; int a[Maxn],Pos[Maxn],F[Maxn],n,Ans; inline int Max(int x ...
- codeforces 732D(二分)
题目链接:http://codeforces.com/contest/732/problem/D 题意:有m门需要过的课程,n天的时间可以选择复习.考试(如果的d[i]为0则只能复习),一门课至少要复 ...
- Maven项目pom.xml文件详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Where与Having的区别
地球人都知道,Where关键字的作用是过滤,选取符合条件的记录,而Having关键字的作用则是,为聚合结果指定条件.但是,在某些条件下,使用这两者可以得到一样的结果. 比如以下的例子: ) FROM ...
- 海洋女神建新installshield交流群了,原来的老群都满了,请加新群哦,记得认真填写验证信息
群号511751143 海洋女神installshield群
- c51
ORG 0000HMOV R7,#08HMOV 83H,#01HMOV R4,#00HAA1:CLR P3.6 CLR P3.4 SETB P3.6 DJNZ R7,AA1AA2:JB P3.0,AA ...