I know this kind of question was asked before, but I cannot for the life of me find it. I need to make a popup window (one of the blue ones, like in the app store for typing the password). So, I have three simple (hopefully) questions.
What is the popup window called?
How do I make one with only scrollable text and a button?
How can I figure out when the button was pressed, and do something with it?
NOTE: I am only asking three questions because I think they can be answered very easily. Infact, I think the first question can be answered just in the code used to make it show the popup window. The third question needs t开发者_如何转开发o be answered just to use this feature.
Also, this is not a "show me teh codez" question. I only want to be pointed to the documentation that talks about these, although direct answers would be very useful.
What is the popup window called?
UIAlertView
How do I make one with only scrollable text and a button?
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Some Title" message:@"\n\n\n\n" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil];
UITextView *someTextView = [[UITextView alloc] initWithFrame:CGRectMake(15, 35, 250, 100)];
someTextView.backgroundColor = [UIColor clearColor];
someTextView.textColor = [UIColor whiteColor];
someTextView.editable = NO;
someTextView.font = [UIFont systemFontOfSize:15];
someTextView.text = @"Enter Text Here";
[alert addSubview:someTextView];
[alert show];
[someTextView release];
[alert release];
How can I figure out when the button was pressed, and do something with it?
As stated before UIAlertViewDelegate
What is the popup window called?
UIAlertView
How do I make one with only scrollable text and a button?
Scrolling text inside the alert view is not supported directly. You can try to add a custom UITextView
as a subview to the alert view to achieve that effect.
How can I figure out when the button was pressed, and do something with it?
By implementing the appropriate delegate method of UIAlertViewDelegate
.
精彩评论