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 はありません。ee/ee または ee/ff を入力すると、is ステートメントは常に else に移動します。誰かが私が間違っていることを教えてもらえますか?

事前にt​​nx。

4

1 に答える 1

2

[email.text isEqualToString:emailComfirm.text]2 つの NSString* オブジェクトの内容を比較するために使用します。== を使用すると、オブジェクトの内容ではなく、2 つのオブジェクトのアドレスが比較されます。これがポインタの仕組みです ポインタへのポインタはCでどのように機能しますか?

于 2012-09-18T19:25:16.563 に答える