我在UIAlertView开始时显示了EULA,其中有Accept按钮。我已成功地按照Problem with opning the page (License agreement page)的链接回答了问题。如何在UIAlertView中添加TextView 320 * 460 iPhone
我只是想表明在开始6页EULA的,但我无法显示具有Alertview EULA内容全尺寸的TextView /滚动视图。任何人都可以建议我正确的方式。提前致谢。
我在UIAlertView开始时显示了EULA,其中有Accept按钮。我已成功地按照Problem with opning the page (License agreement page)的链接回答了问题。如何在UIAlertView中添加TextView 320 * 460 iPhone
我只是想表明在开始6页EULA的,但我无法显示具有Alertview EULA内容全尺寸的TextView /滚动视图。任何人都可以建议我正确的方式。提前致谢。
您可以制作任意大小的alertView并添加任何大小的自定义TextView。使用代码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];
}
但通过使alertView的大小等于整个iPhone的屏幕尺寸,你将失去取消按钮。
也可以使用这种委托方法。
- (void)willPresentAlertView:(UIAlertView *)alertView {
[alertView setFrame:CGRectMake(0, 0, 320, 460)];}
如何将这样一个巨大的文本视图放入警报视图?只需将文本转储到警报视图中并让它以自己的方式呈现,或使用模式视图控制器。 – BoltClock 2012-01-30 06:49:50
如果我们能在alertView显示tableview中......那么为什么不滚动的TextView? – 2012-01-30 06:52:12
为什么您需要在警报视图提供自己的实现?正如我所说的,只需将警报视图的消息设置为文本,它就会处理它。 – BoltClock 2012-01-30 06:53:57