UITextField和UISwitch
来源:互联网 发布:win7 版 人工智能 编辑:程序博客网 时间:2024/06/01 09:15
定义的宽高:
#define SCREEN_WIDHT [[UIScreen mainScreen] bounds].size.width
#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define COMMON_HEIGHT SCREEN_HEIGHT * 0.054
代理:<UITextFieldDelegate>
UITextField这样用滴:
/** <#description#> */
@property(nonatomic,weak)UITextField * edTF;
UITextField * ed_tf = [[UITextFieldalloc]initWithFrame:CGRectMake(10,64,SCREEN_WIDHT-20,COMMON_HEIGHT)];
ed_tf.delegate =self;
ed_tf.placeholder =@"输入点什么";
ed_tf.borderStyle =UITextBorderStyleRoundedRect;
ed_tf.keyboardType =UIKeyboardTypeNumbersAndPunctuation;
//清除输入的内容的叉号
ed_tf.clearButtonMode =UITextFieldViewModeWhileEditing;
[self.viewaddSubview:ed_tf];
_edTF = ed_tf;
UISwitch是这样用滴:
UISwitch *uiswitch = [[UISwitchalloc]initWithFrame:CGRectMake(10,CGRectGetMaxY(ed_tf.frame)+10 ,SCREEN_WIDHT-20,COMMON_HEIGHT)];
uiswitch.on =NO;
[uiswitch addTarget:selfaction:@selector(switchui:)forControlEvents:UIControlEventValueChanged];
[self.viewaddSubview:uiswitch];
点击的实现:-(void)switchui:(id)sender{
UISwitch *Switchi = (UISwitch *)sender;
BOOL switchon = Switchi.isOn;
if(switchon){
//控制输入框内容密文显示
_edTF.secureTextEntry=YES;
}else{
//控制输入框内容明文显示
_edTF.secureTextEntry=NO;
}
}
- UISwitch和UITextField
- UITextField和UISwitch
- iOS UISwitch和UITextField 的监听
- iOS自学笔记之UISwitch和UITextField
- Swift UITextField,UITextView,UISegmentedControl,UISwitch
- UIButton、UITextField、UISlider、UISwitch、UISegmentedControl
- iOS UISwitch UISegmentedControl UITextField使用方法
- UISwitch和UIDatePicker
- 【iOS 开发】基本 UI 控件详解 (UIButton | UITextField | UITextView | UISwitch)
- 【IOS 开发】根本 UI 控件详解 (UIButton | UITextField | UITextView | UISwitch)
- UISwitch
- UISwitch
- UISwitch
- UISwitch
- UISwitch
- UISwitch
- UISwitch
- UISwitch
- Eclipse中安装MemoryAnalyzer插件及使用
- iOS下Hybird实现---OC与JS交互以及swift与JS交互
- ajax评论回复,注意刷新location.reload();
- qt使用SDL播放视频 窗口拉伸 视频闪烁
- PlzNavigate项目: Browser side navigation in Chrome
- UITextField和UISwitch
- oracle 基础知识——环境配置
- ubuntu 用户管理
- ios 手势识别
- git 添加ssh-key查看config
- 百练之垂直直方图
- PAT-A-1028. List Sorting (25)
- 新建SpringBoot eclipse 报错
- 机器学习常见算法总结