如何在UIAlertView iPhone中添加TextView 320*460



我在开始时显示EULA,UIAlertView带有Accept按钮。我已经成功地按照问题的答案打开页面(许可协议页面)链接。

我只想在开始时显示6页EULA,但我无法在Alertview中显示包含EULA内容的全尺寸文本视图/滚动视图。有人能给我推荐合适的方法吗。提前谢谢。

您可以制作任何大小的alertView并添加任何大小的自定义TextView。使用代码剪切

- (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];

}

但通过使alertView的大小等于整个iPhone屏幕的大小,您将失去取消按钮。

也可以使用此委托方法。

- (void)willPresentAlertView:(UIAlertView *)alertView {
[alertView setFrame:CGRectMake(0, 0, 320, 460)];}

最新更新