Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

objective c - How to add TextView 320*460 in UIAlertView iPhone

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.
Happy 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)];}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...