UITextField in UIAlertView on iPhone - how to make it responsive?

前端 未结 10 1412
情歌与酒
情歌与酒 2020-11-28 05:27

I placed a UITextField into a UIAlertView and moved it up so the keyboard wouldn\'t cover it up with the following code:

[dialog setDelegate:self];
[dialog s         


        
10条回答
  •  独厮守ぢ
    2020-11-28 05:51

    This is actually only 1 more line to the regular UIAlertView code. Hope this helps!

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"test" message:@"This is a alert with a textfield" delegate:self cancelButtonTitle:@"YAY" otherButtonTitles:nil];
        alert.alertViewStyle = UIAlertViewStylePlainTextInput;
        [alert show];
        [alert release];
    

    only runs on iOS 5 or later

提交回复
热议问题