IOS代碼筆記之勾選"記住密碼"整體button
本文實(shí)例為大家分享了IOS記住密碼整體button 的實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下
一、效果圖


二、工程圖

三、代碼
RootViewController.h
#import <UIKit/UIKit.h>
@class BECheckBox;
@interface RootViewController : UIViewController
{
BECheckBox *passwordCheck;
}
@property(nonatomic,retain)BECheckBox *passwordCheck;
@end
RootViewController.m
#import "RootViewController.h"
//加入頭文件
#import "BECheckBox.h"
@interface RootViewController ()
@end
@implementation RootViewController
@synthesize passwordCheck;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
//隱藏導(dǎo)航條
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];
}
//記住密碼點(diǎn)擊
-(void)passCheckBoxClick
{
if ([self.passwordCheck isChecked]) {
NSLog(@"記住密碼");
}
else {
NSLog(@"取消記住密碼");
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
IOS中用正則表達(dá)式判斷輸入的內(nèi)容為8-16位且同時(shí)包含數(shù)字和字母
這篇文章主要介紹了IOS中用正則表達(dá)式判斷輸入的內(nèi)容為8-16位且同時(shí)包含數(shù)字和字母,需要的朋友可以參考下2017-06-06
IOS 自定義UICollectionView的頭視圖或者尾視圖UICollectionReusableView
這篇文章主要介紹了IOS 自定義UICollectionView的頭視圖或者尾視圖UICollectionReusableView的相關(guān)資料,需要的朋友可以參考下2017-01-01
iOS使用WebView生成長(zhǎng)截圖的第3種解決方案
這篇文章主要給大家介紹了關(guān)于iOS使用WebView生成長(zhǎng)截圖的第3種解決方案,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2018-09-09
iOS中UILabel實(shí)現(xiàn)長(zhǎng)按復(fù)制功能實(shí)例代碼
在iOS開發(fā)過(guò)程中,有時(shí)候會(huì)用到UILabel展示的內(nèi)容,那么就設(shè)計(jì)到點(diǎn)擊UILabel復(fù)制它上面展示的內(nèi)容的功能,也就是Label長(zhǎng)按復(fù)制功能,下面這篇文章主要給大家介紹了關(guān)于在iOS中UILabel實(shí)現(xiàn)長(zhǎng)按復(fù)制功能的相關(guān)資料,需要的朋友可以參考借鑒,下面來(lái)一起看看吧。2017-10-10
iOS調(diào)試Block引用對(duì)象無(wú)法被釋放的小技巧分享
這篇文章主要給大家分享介紹了關(guān)于iOS調(diào)試Block引用對(duì)象無(wú)法被釋放的小技巧,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)各位iOS開發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09

