//UIActivityIndicatorView //小菊花,加载

 #import "ActivityIndicatorVC.h"

 @interface ActivityIndicatorVC (){
UIActivityIndicatorView *_activity ;
} @end @implementation ActivityIndicatorVC -(void)viewDidLoad{
[super viewDidLoad]; [self createActivityIndicator]; } -(void)createActivityIndicator{
//创建对象
_activity = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(, , , )]; _activity.backgroundColor = [UIColor blackColor]; _activity.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [self.view addSubview:_activity]; //让状态栏中的activityIndicator显示出来
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; //开始动画
[_activity startAnimating]; } // 想要停止的话添加
// [_activity stopAnimating];
//[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; @end 45 // UIProgressView //进度条
#import "ProgressVC.h" @implementation ProgressVC{
UIProgressView *_progress ;
NSTimer *_timer;
} -(void)viewDidLoad{
[super viewDidLoad]; self.btn.hidden = YES; [self createProgress]; [self createTimer];
} -(void)createProgress{
_progress = [[UIProgressView alloc]initWithFrame:CGRectMake(, , , )];
[self.view addSubview:_progress];
// progress.backgroundColor = [UIColor lightGrayColor]; _progress.tintColor = [UIColor redColor]; _progress.progressTintColor = [UIColor greenColor];
_progress.trackTintColor = [UIColor blueColor]; _progress.progress = 0.01;
} -(void)createTimer{
_timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(run ) userInfo:nil repeats:YES];
} -(void)run{
_progress.progress += 0.01;
} @end 90 // UISegmentedControl //分段 -(void)viewDidLoad{
[super viewDidLoad]; self.btn.hidden = YES; [self createSegment];
} -(void)createSegment{ NSArray *items = @[@"", @"", @""]; UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:items]; segment.frame = CGRectMake(, , , );
segment.backgroundColor = [UIColor magentaColor];
segment.tintColor = [UIColor yellowColor];
segment.selectedSegmentIndex = ; [segment insertSegmentWithTitle:@"" atIndex: animated:YES];
[segment insertSegmentWithImage:[UIImage imageNamed:@"tab_0"] atIndex: animated:YES];
//让图片显示原始图片
UIImage *img = [[UIImage imageNamed:@"tab_0"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; [segment insertSegmentWithImage:img atIndex: animated:YES]; [self.view addSubview:segment]; //添加事件
[segment addTarget:self action:@selector(segmentSelected:) forControlEvents:UIControlEventValueChanged]; } -(void)segmentSelected:(UISegmentedControl *)segment{
NSLog(@"%ld", segment.selectedSegmentIndex);
} //UIStepper //步进 -(void)viewDidLoad{
[super viewDidLoad]; self.btn.hidden = YES; [self createStepper];
} -(void)createStepper{
UIStepper *stepper =[[ UIStepper alloc]initWithFrame:CGRectMake(, , , )];
[self.view addSubview:stepper]; stepper.tintColor = [UIColor redColor];
stepper.backgroundColor = [UIColor greenColor]; stepper.minimumValue = ;
stepper.maximumValue = ;
stepper.stepValue = ;
stepper.wraps = YES;
stepper.autorepeat = YES; [stepper addTarget:self action:@selector(steperValueChanged:) forControlEvents:UIControlEventValueChanged];
} -(void)steperValueChanged:(UIStepper *)stepper{
NSLog(@"%f", stepper.value); } //UISwitch //开关 -(void)viewDidLoad{
[super viewDidLoad]; self.btn.hidden = YES; [self createSwitch];
} -(void)createSwitch{
UISwitch *mySwitch = [[UISwitch alloc]initWithFrame:CGRectMake(, , , )]; mySwitch.onTintColor = [UIColor redColor];
mySwitch.tintColor = [UIColor greenColor]; [self.view addSubview:mySwitch]; [mySwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
} -(void)switchValueChanged:(UISwitch *)mySwitch{
if (mySwitch.isOn) {
NSLog(@"on");
} else{
NSLog(@"off");
}
} //UITextView //文本
-(void)viewDidLoad{
[super viewDidLoad]; self.btn.hidden = YES; [self createTextView];
} -(void)createTextView{
UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(, , , )]; [self.view addSubview:textView ];
} //UIAlertController //警报管理
- (void)btnClicked { UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:@"删除" message:@"是否确定要删除该数据" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil ];
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"具体的删除数据的代码");
}]; [alertCtrl addAction:cancelAction];
[alertCtrl addAction:deleteAction]; [self presentViewController:alertCtrl animated:YES completion:nil]; } - (void)btnClicked3 { UIAlertController *alertCtrl = [ UIAlertController alertControllerWithTitle:@"警告" message:@"需要输入用户名和密码" preferredStyle:UIAlertControllerStyleAlert];
// 添加文本框
[alertCtrl addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
// 可以对文本框进行设置
textField.placeholder = @"用户名";
}]; [alertCtrl addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = @"密码";
textField.secureTextEntry = YES; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pwdTextChanged) name:UITextFieldTextDidChangeNotification object:textField];
}]; // 添加一个动作,就是一个按钮
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"登录" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
// 用户点击这个按钮的操作
NSLog(@"用户名:%@, 密码:%@", alertCtrl.textFields[].text , alertCtrl.textFields[].text );
}];
action2.enabled = NO;
[alertCtrl addAction:action2]; // 弹出提示信息框
[self presentViewController:alertCtrl animated:YES completion:nil]; } -(void)pwdTextChanged{
// 取得弹出的UIAlertController对象
UIAlertController *alertCtrl = (UIAlertController *) self.presentedViewController;
if (alertCtrl) {
UIAlertAction *loginAction = alertCtrl.actions.firstObject;
loginAction.enabled = YES;
} } - (void)btnClicked2 { UIAlertController *alertCtrl = [ UIAlertController alertControllerWithTitle:@"警告" message:@"电量低" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"知道了");
}];
[alertCtrl addAction:action1];
[alertCtrl addAction:action2]; [self presentViewController:alertCtrl animated:YES completion:nil]; }

UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController的更多相关文章

  1. webform中几个常用的控件

    一,简单控件 1,Lable——标签:在网页中呈现出来的时候会变成span标签 属性:Text——标签上的文字  BackColor,ForeColor——背景色,前景色 Font——字体 Bold- ...

  2. swift系统学习控件篇:UIProgressView+NSTimer+UIstepper+UIAlertController

    工作之余,学习下swift大法.把自己的学习过程分享一下.当中的布局很乱,就表在意这些细节了.直接上代码: UIProgressView+NSTimer+UIstepper UIStepper UIP ...

  3. 关于如何在 Unity 的 UI 菜单中默认创建出的控件 Raycast Target 属性默认为 false

    关于如何在 Unity 的 UI 菜单中默认创建出的控件 Raycast Target 属性默认为 false 我们在 Unity 中通过 UI 菜单创建的各种控件,比如 Text, Image 等, ...

  4. 【风马一族_Android】第4章Android常用基本控件

    第4章Android常用基本控件 控件是Android用户界面中的一个个组成元素,在介绍它们之前,读者必须了解所有控件的父类View(视图),它好比一个盛放控件的容器. 4.1View类概述 对于一个 ...

  5. .Net中使用无闪刷新控件时提示框不显示

    今天做提示框的时候一直不显示,让我郁闷好久,晚上吃饭的时候问了同事一下,他给了一个思路, 他说可能是因为由于页面中的无闪刷新导致的结果:百度了一下真找到了解决方法 在页面中存在无闪刷新控件的时候提示框 ...

  6. ios开发中经常用到的控件

    以下是按照使用频率对ios的控件进行罗列. 1.最常用的UI控件: UIButton (按钮).UILabel (文本标签).UITextField (文本输入框).UIImageView( 图片显示 ...

  7. Unity3D入门之GUI基础以及常用GUI控件使用(2)

    1.GUI基础 (1)GUI部分是每帧擦除重绘的,只应该在OnGUI中绘制GUI,按钮:GUILayout.Button(“Hello”); 只读标签:GUILayout.Label() (2)修改控 ...

  8. VC++ 中滑动条(slider控件)使用 [转+补充]

    滑动控件slider是Windows中最常用的控件之一.一般而言它是由一个滑动条,一个滑块和可选的刻度组成,用户可以通过移动滑块在相应的控件中显示对应的值.通常,在滑动控件附近一定有标签控件或编辑框控 ...

  9. 【转】ASP.NET常用数据绑定控件优劣总结

    转自:http://www.cnblogs.com/Olive116/archive/2012/10/24/2736570.html ASP.NET常用数据绑定控件优劣总结   本文的初衷在于对Asp ...

随机推荐

  1. ES6笔记(6)-- Set、Map结构和Iterator迭代器

    系列文章 -- ES6笔记系列 搞ES6的人也是够无聊,把JS弄得越来越像Java.C++,连Iterator迭代器.Set集合.Map结构都出来了,不知道说什么好... 一.简单使用 1. iter ...

  2. SQL--类型转换

    Convert函数和Cast函数都是转化函数,效果是一样的. cast函数,转化,如果转化之后,年龄还是Null的话,就显示为“未知” Convert函数和Cast函数都是转化函数,效果是一样的.

  3. C#对图片文件的压缩、裁剪操作初探

    在做项目时,对图片的处理,以前都采用在上传时,限制其大小的方式,这样带来诸多不便.毕竟网站运维人员不一定会对图片做处理,经常超出大小限制,即使会使用图片处理软件的,也由于个人水平方面原因,处理效果差强 ...

  4. ASP.NET MVC系列:添加视图

    虽然在上一篇文章中我们知道通过控制器可以在浏览器输出HTML页面,但是这不是控制器主要干的事,因为页面上我为还要做很多好看的特效,页面展示的事情当然交给视图来做了:下面我们就来看看如何添加一个视图 添 ...

  5. [Asp.net 5] Configuration-新一代的配置文件(接口定义与基础实现)

    关于配置文件的目录:[Asp.net 5] Configuration-新一代的配置文件 本系列文章讲的是asp.net 5(Asp.net VNext)中的配置文件部分,工程下载地址为:https: ...

  6. Mailbox unavailable. The server response was: 5.1.1 User unknown

    昨晚至今早,在新的项目中,实现一个小功能,就是当有访问者浏览网页在留言簿留言时,系统把留言内容发送至某一个邮箱或是抄送指定的邮箱中. 使用以前能正常发送邮件的代码,但在新项目中,测试时,就是出现标题的 ...

  7. ASP.NET MVC怎样引用你的model

    在视图中,引用model,并绑定.有2种情况,一是数据集,另一个是单个model. 实现之前,有准备一个数据吧. 创建一个model: source code: namespace Insus.NET ...

  8. 控制器描述者(ControllerDescriptor),行为方法描述者(ActionDescriptor),参数描述者(ParameterDescriptor)的小结

    Model的绑定是在Action方法绑定参数时发生的,这个绑定的参数过程要用到的元数据来自于控制器,行为方法和参数的描述者ContrllerDescriptor,ActionDescriptor和Pa ...

  9. C# 委托和事件(二):使用.Net框架中的EventArgs和EventHandler

    前面一篇里提到事件是通过委托来进行关联的,而委托是可以带各种各样的参数的,其中就可以用事件参数(EventArgs),同时,也可以用.Net框架里边提供的一个委托EventHandler来Handle ...

  10. 背水一战 Windows 10 (8) - 控件 UI: StateTrigger

    [源码下载] 背水一战 Windows 10 (8) - 控件 UI: StateTrigger 作者:webabcd 介绍背水一战 Windows 10 之 控件 UI VisualState 之 ...