标签:style blog http io ar color sp for 文件
效果图:
工程图:
此代码需要加入第三方库BECheckBox.
代码:
#import "RootViewController.h" //加入头文件 #import "BECheckBox.h" @interface RootViewController () @end @implementation RootViewController @synthesize passwordCheck; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //隐藏导航条 self.navigationController.navigationBarHidden=YES; //忘记密码按钮 BECheckBox *passCheckBox=[[BECheckBox alloc]initWithFrame:CGRectMake(61, 55, 80, 30)]; [passCheckBox setTitle:@"记住密码" forState:UIControlStateNormal]; [passCheckBox setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; passCheckBox.titleLabel.font=[UIFont systemFontOfSize:16]; [passCheckBox setTarget:self fun:@selector(passCheckBoxClick:)]; passCheckBox.backgroundColor=[UIColor clearColor]; self.passwordCheck=passCheckBox; [self.view addSubview:self.passwordCheck]; } //记住密码点击 -(void)passCheckBoxClick:(id)sender { if ([self.passwordCheck isChecked]) { NSLog(@"记住密码"); } else { NSLog(@"取消记住密码"); } }
标签:style blog http io ar color sp for 文件
原文地址:http://www.cnblogs.com/yang-guang-girl/p/4128058.html