UISwitch(开关控件)、UISegmentedControl(分段控件)
NSLog(@"触发了改方法");
}
-(void)myswitch:(UISwitch *)s{
UISwitch *s2 = (UISwitch *)[self.view viewWithTag:1];
NSLog(@"%d",s.isOn);
NSLog(@"%d",s2.isOn);
[segment1 insertSegmentWithImage:[UIImage imageNamed:@"3.jpg"] atIndex:1 animated:YES];//插入图片并允许动画
NSLog(@"段数:%zi",segment1.numberOfSegments);//获取段数
[segment1 setTitle:@"我们" forSegmentAtIndex:0];
NSString *str = [segment1 titleForSegmentAtIndex:1];//获取图片标题,注意图片中插入的位置要对应起来
NSLog(@"图片标题=%@",str);
UIImage *image = [segment1 imageForSegmentAtIndex:1];
NSLog(@"图片=%@",image);
//[segment1 setWidth:100 forSegmentAtIndex:0];//设置某段的宽
//[segment1 setEnabled:NO forSegmentAtIndex:0];//设置某一段是否被激活
//[segment1 setEnabled:NO];//整体不被激活
segment1.selectedSegmentIndex = 1;//设置默认选中项
NSLog(@"%zi",segment1.selectedSegmentIndex);//获取当前被选中的段
segment1.tintColor = [UIColor greenColor];//边框和选中颜色
[segment1 setBackgroundImage:[UIImage imageNamed:@"3"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// UIControlStateNormal、UIBarMetricsDefault 设置成默认的就好
NSLog(@"分段被点击");
UISegmentedControl *s = [[UISegmentedControl alloc]initWithFrame:CGRectMake(50, 400, 100, 50)];
[s insertSegmentWithTitle:@"分段" atIndex:3 animated:YES];
[s insertSegmentWithTitle:@"函数" atIndex:0 animated:YES];//增加
UISwitch(开关控件)、UISegmentedControl(分段控件)的更多相关文章
- iOS系列 基础篇 09 开关、滑块和分段控件
iOS系列 基础篇 09 开关.滑块和分段控件 目录: 案例说明 开关控件Switch 滑块控件Slider 分段控件Segmented Control 1. 案例说明 开关控件(Switch).滑块 ...
- UISegmentedControl——分段控件
分段控件,提供了一组按钮,但是只能激活一个.通过UIControlEventValueChanged事件实现与用户的交互,并通过selectedSegmentIndex判断当前选定的控件,通过titl ...
- ios 初体验< UISegmentedControl 分段控件>
小知识: 数组快速创建 @[@"",@"",@"",@"".......],字典快速创建方法:@{@"&q ...
- 【UISegmentedControl】- 分段控件
一.初始化 二.常见的属性 1.segmentedControlStyle属性:设置基本的样式 2.momentary属性:设置在点击后是否恢复原样 . 3.numberOfSegments属性:只读 ...
- 使用开关、分段控件和web视图
#import "XViewController.h" @interface XViewController () @end @implementation XViewContro ...
- iOS:分段控件UISegmentedControl的详细使用
分段控件:UISegmentedControl 功能:分段的控制.页面的切换等. 介绍:当用户输入不仅仅是布尔值时,可使用分段控件(UISegmentedControl).分段控件提供一栏按钮 ...
- iOS开发基础控件--UISegmentedControl
UISegmentedControl全局外观设置 分段控件是我们常用的控件之一,今天把具体用法总结了下: 1.初始化UISegmentedControl [plain] view plaincopy ...
- [Swift通天遁地]九、拔剑吧-(4)使用开源类库创建可滑动的Segment分段控件
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- HslControls组件库 工业控件库 曲线控件 时间控件 管道控件 温度计控件 阀门控件 传送带控件 进度条控件 电池控件 数码管控件等等
本篇博客主要对 HslControls 组件做一个大概的总览介绍,更详细的内容可以参照页面里的子链接,还有github上的源代码,然后进行相关的学习,和使用. Prepare 先从nuget下载到组件 ...
- WinForm用户控件、动态创建添加控件、timer控件--2016年12月12日
好文要顶 关注我 收藏该文 徐淳 关注 - 1 粉丝 - 3 0 0 用户控件: 通过布局将多个控件整合为一个控件,根据自己的需要进行修改,可对用户控件内的所有控件及控件属性进行修 ...
随机推荐
- linux 查询目录下包含关键字的所有文件
linux查找目录下的所有文件中是否含有某个字符串 查找目录下的所有文件中是否含有某个字符串 find .|xargs grep -ri "IBM" 查找目录下的所有文件中是否含有 ...
- python中getattr函数 hasattr函数
hasattr(object, name)作用:判断对象object是否包含名为name的特性(hasattr是通过调用getattr(ojbect, name)是否抛出异常来实现的).示例: > ...
- 【转】用Python实现各种排序算法
以下代码均为python3版本的代码 # 冒泡排序 # 比较相邻的元素大小,将小的前移,大的后移,就像水中的气泡一样,最小的元素经过几次移动,会最终浮到水面上. def bubbleSort(list ...
- 解决阿里云数据库RDS报错The table '/home/mysql/data3015/tmp/#sql_13975_23' is full
查询任何一条语句都显示 The table '/home/mysql/data3015/tmp/#sql_13975_23' is full 查看了下数据库利用磁盘空间没有满, 阿里云的处理方式: 1 ...
- 获取ServletContext
ServletConfig config.getServletContext(): GenericServlet this.getServletContext(); HttpSe ...
- nginx rewirte
server { listen 8888; server_name jobPhp; root F:\ck\Porject\quanRelease\quanJob; try_files $uri $ur ...
- Error -27780: [GENERAL_MSG_CAT_SSL_ERROR]connect to host "124.202.213.70" failed: [10054] Connection reset by peer [MsgId: MERR-27780]
解决方案一: 备注: 此方案如果请求响应时间太长,勾选"WinInet replay instead of Sockets(Windows only)"将会导致如下错误:
- afterTextChanged() callback being called without the text being actually changed
afterTextChanged() callback being called without the text being actually changed up vote8down votefa ...
- 解决C# 转到定义时打开的是元数据文件而非源代码文件的问题
原因:添加引用时 使用的是“浏览"选项卡,选择了项目生成的dll作为引用的内容. 解决:添加引用时 使用的是"项目"选项卡,选择了项目本身作为引用的内容.
- iOS界面的绘制和渲染
界面的绘制和渲染 UIView是如何到显示的屏幕上的. 这件事要从RunLoop开始,RunLoop是一个60fps的回调,也就是说每16.7ms绘制一次屏幕,也就是我们需要在这个时间内完成view的 ...