搜尋此網誌

顯示具有 UITextField 標籤的文章。 顯示所有文章
顯示具有 UITextField 標籤的文章。 顯示所有文章

2012年9月6日 星期四

監聽TextField change


.h

@property (strong, nonatomic) IBOutlet UITextField *account;
@property (strong, nonatomic) IBOutlet UITextField *password;

@property (strong, nonatomic) IBOutlet UITextField *displayAccount;
@property (strong, nonatomic) IBOutlet UITextField *displayPassword;



.m
- (void)viewDidLoad
{
//建立監聽事件


    [displayAccount addTarget:self action:@selector(onAccountChange) forControlEvents:UIControlEventEditingChanged];
    [displayPassword addTarget:self action:@selector(onPasswordChange) forControlEvents:UIControlEventEditingChanged];
}


-(void) onAccountChange{
    account.text=displayAccount.text;
}
-(void) onPasswordChange{
    password.text=displayPassword.text;
}

2012年8月29日 星期三

監控UITextField變化 Listen for UItextfield change


- (void)viewDidLoad {
[textlabel addTarget:self action:@selector(onTextFieldDidChange) forControlEvents:UIControlEventEditingChanged];
}
-(void)onTextFieldDidChange {
NSLog(@”input = %@”,textlabel.text);
}