ios 学习笔记之控件属性

1.文本框

设置密码属性:Secure Text Entry 勾选;

设置文本框带清除属性: Clear Button =Is always visible;  默认是不带清除属性:Never appears 

设置文本框默认带出文字属性:Placeholder=用户自定义输入;

设置文本框键盘用户输入完成隐藏代码:

  [self.text resignFirstResponder];//适用于单个文本框输入完成时隐藏

  [self.view endEditing:YES];//适用于全部文本框输入完成时隐藏;

2.按钮

设置高亮状态:State Config =Highlighted(高亮) Default (默认状态);

设置默认状态和高亮状态下设置按钮背景图片属性:Background=用户自定义图片名称,例如 img_01;

3、属性

HigHlighed Adjusts Image  高亮状态点击无的反映
User Interaction Enabled  是否与用户交互
4、设置状态栏
//改变状态栏的文字颜色为白色
- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}
//隐藏状态栏
-(BOOL)prefersStatusBarHidden
{
    return YES;
}
 UIAlertView * alerView = [[UIAlertView alloc] initWithTitle:@"操作提示" message:@"恭喜通关!" delegate:nil cancelButtonTitle:@"确定"otherButtonTitles:@"确定",nil];     
//显示对话框
 [alerView show];
//设置userview与用户交互
 self.userview.userInteractionEnabled =YES;
//清除所有控件
 [self.userview.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
//给userBtn添加单击事件 @selector(optiondataClick:)把当前点击的按钮传到事件中
 [userBtnaddTarget:self action:@selector(optiondataClick:) forControlEvents:UIControlEventTouchUpInside];
 //声明空的字符串变量拼接时使用
 NSMutableString* userInput =[NSMutableString string];
 //拼接
 [userInput appendString:Data];
 //延迟0.5秒调用方法
[self performSelector:@selector() withObject:nil afterDelay:0.5];
 //把view 中的一个子控件显示到最上层
 [self.view bringSubviewToFront:self.btnIcon];
//获取当前页面,最后一个控件最大的的Y值;
  CGFloat MaxH = CGRectGetMaxY(self.lastImageView.frame);
//获取当前页面,最后一个控件最大的的X值;
  CGFloat MaxH = CGRectGetMaxX(self.lastImageView.frame);
原文地址:https://www.cnblogs.com/zzgt/p/4796023.html