0
我有這樣一段代碼:文本框的文本內容比較不會工作
if (email.text == emailComfirm.text) {
UIAlertView *emailAllertView = [[UIAlertView alloc] initWithTitle:@"Succes" message:@"Yaaay, je kan nu gebuik gaan maken van Vogelspotter." delegate:self cancelButtonTitle:@"Direct aanmelden" otherButtonTitles: nil];
[emailAllertView show];
// Doing some other code here
[self dismissModalViewControllerAnimated:YES];
}else{
NSLog(@"email: %@", email.text);
NSLog(@"email: %@", emailComfirm.text);
UIAlertView *emailAllertView = [[UIAlertView alloc] initWithTitle:@"Foutmelding" message:@"De opgegeven email adressen komen niet met alkaar overeen" delegate:self cancelButtonTitle:@"Probeer het nog eens" otherButtonTitles: nil];
[emailAllertView show];
}
不知何故,沒有moather wath我在textfiels鍵入時,是statment總是轉到別的,如果我進入EE/EE或EE/FF。有人能告訴我我做錯了什麼嗎?
tnx提前。
可能重複[爲什麼這段代碼不能識別NSString是否相等?](http://stackoverflow.com/questions/8625936/),[比較Cocoa中的字符串](http: (比較兩個字符串失敗)(http://stackoverflow.com/questions/9322457/),[瞭解'NSString'ObjC比較](http:// stackoverflow。 com/questions/3703554 /) –
Tnx。這確實解決了問題 – Roeliee