~~~
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
UITextField *textFiled;
- (void)viewDidLoad {
[super viewDidLoad];
[self addTextField];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void) addTextField
{
UILabel *prefixLabel = [[UILabel alloc]initWithFrame:CGRectZero];
prefixLabel.text=@"输入用户名:";
[prefixLabel setFont:[UIFont boldSystemFontOfSize:14]];
[prefixLabel sizeToFit];
textFiled = [[UITextField alloc] initWithFrame:CGRectMake(20, 50, 280, 30)];
textFiled.borderStyle = UITextBorderStyleRoundedRect;
textFiled.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;
[textFiled setFont:[UIFont boldSystemFontOfSize:12]];
textFiled.placeholder = @"Simple Text filed";
[textFiled setTextColor:[UIColor blueColor]];
textFiled.leftView = prefixLabel;
textFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTitle:@"提交" forState:UIControlStateNormal];
[btn sizeToFit];
textFiled.rightView=btn;
textFiled.rightViewMode = UITextFieldViewModeAlways;
[btn addTarget:self action:@selector(onClick) forControlEvents:UIControlEventTouchUpInside] ;
[self.view addSubview:textFiled];
}
-(void)onClick
{
NSLog(@"获取输入框值:%@",textFiled.text);
}
@end
~~~
- 各种语言一起撸
- 前言
- 第一章 各种语言类讲解对比
- 1.1 基于类的面向对象语言
- 第二章 各种语言面向对象编程
- 2.1 Javascript面向对象编程
- 2.1.1 JS类实现
- 2.1.2 JS类继承
- 2.2 Object-C面向对象编程
- 2.3 Android面向对象编程
- 2.4 PHP面向对象编程
- 第三章 JS+OC+ADT语言对比
- 3.1 视图
- 3.1.1 JavaSript创建视图
- 3.1.2 Object-c创建视图
- 3.1.2.1 xib视图视图创建
- 3.1.3 Andriod创建视图
- 3.1.3.1 xml视图创建
- 3.2 事件
- 3.2.1 JavaSript事件绑定
- 3.2.2 Object-c事件代理
- 3.2.2.1 事件代理
- 3.2.3 Andriod事件监听
- 第四章 PHP服务端语言