IOS_TextField,UIButton
来源:互联网 发布:软件原型设计 编辑:程序博客网 时间:2024/06/09 19:06
一 :
TextField:
//单行文本输入框
UITextField *username = [[UITextFieldalloc] initWithFrame:CGRectMake(10,50, 210, 30)];
username.backgroundColor = [UIColorwhiteColor];
[self.windowaddSubview:username];
username.borderStyle =UITextBorderStyleRoundedRect;
username.placeholder =@"请输入用户名";
username.textAlignment = NSTextAlignmentCenter;
[usernamerelease];
//多行输入
UITextField *username1 = [[UITextFieldalloc] initWithFrame:CGRectMake(10,140, 210, 60)];
username1.backgroundColor = [UIColorredColor];
[self.windowaddSubview:username1];
// username1.clearButtonMode = UITextBorderStyleRoundedRect;
//加密输入
// username.secureTextEntry = YES;
username1.keyboardType =UIKeyboardTypeURL;
Button:
//UIButton
UIButton *button = [UIButtonbuttonWithType:UIButtonTypeSystem];
//title
button.frame =CGRectMake(80,370, 100, 30);
button.backgroundColor = [UIColoryellowColor];
[self.windowaddSubview:button];
//给button添加标题
[button setTitle:@"title"forState:UIControlStateNormal];
//点击的时候有高亮状态
button.showsTouchWhenHighlighted =YES;
// 给button指定一个功能方法
//参数1 :点击按钮之后,让什么对象调用方法(self指当前类的对象)
//参数2 :让参数1的对象调用方法(写方法名:)
//参数3 :
[button addTarget:selfaction:@selector(buttonAction:)forControlEvents:UIControlEventTouchUpInside];
// [button setTitle:@"注册" forState:UIControlStateNormal];
// [button addTarget:self action:@selector(bu) forControlEvents:UIControlEventTouchUpInside];
//按钮点击方法的写法格式
//- (void)方法名 :(UIButton *)btn
-(void) buttonAction:(UIButton *)btn
{
NSLog(@"点击");
self.window.backgroundColor = [UIColorblackColor];
}
- IOS_TextField,UIButton
- UIButton
- UIButton
- UIButton
- uibutton
- UIButton
- UIButton
- UIButton
- UIButton
- UIButton
- UIButton
- UIBUTTON
- UIButton
- UIButton
- UIButton
- UIBUTTON
- UIButton
- UIButton
- Leetcode: Best Time to Buy and Sell Stock IV
- IOS_UI_Label
- PhotoView源码分析(3)
- 3Sum Closest
- 收藏的人工智能相关网站
- IOS_TextField,UIButton
- 字符串复制函数strcpy的实现算法
- u-boot2010.06的移植(1)——准备移植
- Android:使用fragment(碎片)—让你的应用更灵活(一)简单运用
- 加载上传图片,获取文件名、文件路径并保存到程序的文件夹中
- 数据结构 - 内存
- 漫谈C指针第五讲---声明指针常量
- 最大子数组乘积算法
- postgresql 可调试