UITextView没有加载/显示大文本?

时间:2013-01-21 10:35:45

标签: ios objective-c xcode uitextview

我的登录界面中有一个简单的UITextView,我需要显示条款和条件。条件。我在条款和条件中有一个非常大的文本。在界面构建器中,我已经向UITextView添加了文本。在界面构建器中,文本正确显示。但是当我运行应用程序时,UITextView是空的。如果我在UItextView中提供小文本,它会正确呈现,但不会显示大/大文本。

任何人都可以帮助我。


这是代码。

- (IBAction)showTermsOfUse:(id)sender{
    termsOfUseText.text = @"/***/";
    termsOfUseText.scrollEnabled = YES;

    [UIView beginAnimations:nil context:nil]; // begins animation block
    [UIView setAnimationDuration:0.6];        // sets animation duration
    [UIView setAnimationDelegate:self];
    termsOfUse.frame = CGRectMake(0,0,320,416);
    [UIView commitAnimations];   // commits the animation block.  This Block is done.
}

3 个答案:

答案 0 :(得分:0)

我也遇到了同样的问题,我解决了我接受UITextView的IBOutlet并在代码中设置这样的值

UITextView *txtView=[[UITextView alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
[txtView setText:@"Your long text"];
[txtView setEditable:NO];
[self.view addSubview:txtView];
[txtView release];

另一种选择是使用webview并在webview中加载你的内容。

答案 1 :(得分:0)

以编程方式创建此UITextView

UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(AsYouNeed)];
[textView  setFont: [UIFont fontWithName:@"YourFontName" size:YourSize]];
textView.text = @"test my font size";
[textview setUserInteractionEnabled:TRUE];  
[self.view addSubview:textView];
[textView release];

可能,对你有帮助:)

答案 2 :(得分:0)

谢谢大家..我发现解决方案现在正在运行.. 以下是答案...... 通过编程方式提供文本....和

termsofUseText.text =   @"MY LARGE TEXT GOES HERE......    "
termsOfUseText.scrollEnabled = YES;
termsOfUseText.userInteractionEnabled = YES;
termsOfUseText.editable = NO;
相关问题