问题
I am showing EULA at the start with UIAlertView having Accept button. I have successfully followed answer on Problem with opning the page (License agreement page) link.
I just want to show 6 pages of EULA at the start but I am unable to show the full size textview/scrollview having EULA content in Alertview. Can anyone suggest me the proper way. Thanks in advance.
回答1:
You can make alertView of any size and add custom TextView of any size. Use code snippiest
- (void) doAlertViewWithTextView {
UIAlertView *alert = [[UIAlertView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
alert.title = nil;
alert.message = nil;
alert.delegate = self;
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:nil];
UITextView *textView = [[UITextView alloc] initWithFrame:alert.bounds];
textView.text = @"This is what i am trying to add in alertView.\nHappy New Year Farmers! The new Winter Fantasy Limited Edition Items have arrived! Enchant your orchard with a Icy Peach Tree, and be the first farmer among your friends to have the Frosty Fairy Horse. Don't forget that the Mystery Game has been refreshed with a new Winter Fantasy Animal theme! ";
textView.keyboardAppearance = UIKeyboardAppearanceAlert;
textView.editable = NO;
[alert addSubview:textView];
[textView release];
[alert show];
[alert release];
}
But by making the size of alertView equal to size of whole iPhone screen you will lose cancel button.
Also use this delegate method.
- (void)willPresentAlertView:(UIAlertView *)alertView {
[alertView setFrame:CGRectMake(0, 0, 320, 460)];}
来源:https://stackoverflow.com/questions/9060310/how-to-add-textview-320460-in-uialertview-iphone