iOS开发中几个有意思的小控件
来源:互联网 发布:西装面料品牌 知乎 编辑:程序博客网 时间:2024/04/23 20:39
大家好,今天为大家分享一些iOS开发的几个有意思的小控件
在iOS开发的过程中,会遇到很多的方法,我们应该学会多运用这些方法
下面为大家讲解几个小控件
左右选择框
//定义一个UIsegmentedControl的控件,添加字体
UISegmentedControl *seg = [[UISegmentedControl alloc]
initWithItems:@[@"ddd",@"ddd"]];
//设置坐标和大小
[seg setFrame:CGRectMake(50, 100, 100, 30)];
//添加视图
[_window addSubview:seg];
//旋转按钮
定义一个UIActivitylndicatorView,并设置坐标
UIActivityIndicatorView *alert = [[UIActivityIndicatorView
alloc]initWithFrame:CGRectMake(50, 50, 50, 50)];
//设置背景颜色
[alert setColor:[UIColor redColor]];
//添加视图
[_window addSubview:alert];
//开启动画
[alert startAnimating];
//下弹选择框
在这个选择框中,可以看到标题和很多的选项,initWithTitle是设置标题
的,delegate是设置控件使用协议的代理人,我们设置为自己,canceButtonTitle
是设置弹出菜单的最下面的取消行,destructiveButton是设置红色字体的横
向栏,只有这个标题栏是居顶端并且是红色的,otherButtonTitle是设置其它横
向栏,可以无限添加.
// UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"标题"
delegate:self cancelButtonTitle:@"取消"
destructiveButtonTitle:@"buttonq"
otherButtonTitles:@"button2",@"ddddd", nil];
//添加视图
// [sheet showInView:_window];
// //滑动选择框,移动蜂窝数据的那个按钮就是我们所说的UISwith,定义
并设置大小
//
UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectMake(50, 150, 50, 30)];
////
[sw setBackgroundColor:[UIColor redColor]];
//
[_window addSubview:sw];
//工具条
设置工具条,此控件就是照相机最上边那条黑边
UIToolbar *tool = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 528,
320, 40)];
//设置背景颜色
[tool setBackgroundColor:[UIColor blueColor]];
[_window addSubview:tool];
这几个控件有很多应用的地方,我们可以灵活运用.
- iOS开发中几个有意思的小控件
- 几个有意思的小程序
- java的几个有意思的小程序
- 几个有意思的C语言小函数
- C程序设计几个有意思的小例子
- 牛客几个有意思的小题
- iOS开发--封装的几个小动画
- 事务操作中几个有意思的概念
- 开发中碰到的几个小问题
- iOS开发中字符串处理成需要的格式的几个小例子
- 关于String的几个有意思的小问题
- C语言比较有意思的几个小程序
- 找了几个有意思的简单小题目
- 几个有意思的宏
- 几个有意思的游戏
- 几个有意思的算法
- 几个有意思的算法
- 有意思的几个网站
- Qt android 调试与发布的一些东西
- O2O与B2C区别
- CI框架使用(一)
- C语言产生满足正态分布的随机数
- Struts 1 之<html>标签库
- iOS开发中几个有意思的小控件
- 第二天:栈与队列
- C++生成并调用dll文件
- 进程与线程的区别
- MSMQ 消息队列、监听MSMQ消息、消息扫描
- 芯客-Rayeager PX2应用之USB摄像头
- 2015/1/26实验室会议
- 经验总结43--新旅程
- COCOS2D-X 停止手打所有cpp文件到android.mk