iphone - UIAlertView 中的 UITextView 大文本

标签 iphone objective-c ios ios4

我有一个 UIAlertViewUITextView。 在 ViewDidAppear 上,我使用大文本执行 [textView setText:] ,但警报显示一个空的 textView,只有在我触摸 textView 进行滚动后,文本才会出现。

我应该怎么做才能使文本出现在警报的 textView 中,而不需要滚动它来“刷新”它?

谢谢!

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];



    av = [[UIAlertView alloc]initWithTitle:@"Terms of Service" message:@"\n\n\n\n\n\n\n" delegate:self cancelButtonTitle:@"Disagree" otherButtonTitles:@"Agree",nil];


    UITextView *myTextView = [[UITextView alloc] initWithFrame:CGRectMake(12, 50, 260, 142)];


    [myTextView setTextAlignment:UITextAlignmentCenter];
    [myTextView setEditable:NO];

    myTextView.layer.borderWidth = 2.0f;
    myTextView.layer.borderColor = [[UIColor darkGrayColor] CGColor];
    myTextView.layer.cornerRadius = 13;
    myTextView.clipsToBounds = YES ;

    [myTextView setText:@"LONG LONG TEXT"];

    [av addSubview:myTextView];

    [myTextView release];

    [av setTag:1];


    [av show];

}

最佳答案

这是因为您最初将 UIAlertView 的消息设置为 @"\n\n\n\n\n\n\n"。首先设置 UITextView,然后将 UIAlertView 的消息设置为 textView 的文本。

关于iphone - UIAlertView 中的 UITextView 大文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11467244/

相关文章:

iphone - UITextField 通过 Interface Builder 更改字体大小

objective-c - 来自 Clang 的 "Leak of returned object"是什么意思?

ios - 创建自定义 iOS 越狱键盘

ios - 在什么情况下运行时可能会在 iOS 中生成一个排序的方法列表

iphone - 如何隐藏 tabBarController 的选项卡?

ios - 更新大量 NSManagedObject 的有效方法

iphone - iOS 应用程序 Admob 文本和图像横幅分发

iphone - 我可以为 Cocoa Touch 应用程序开发自己的 objective-C 框架吗?

iphone - 如何使 UITableViewCell 上的滑动删除按钮变小?

ios - 在 Objective-C 中使用带或不带后缀 .f 的 CGFloat 是否存在性能差异