Search code examples
iosobjective-cxcodeuitextview

UITextView not loading/showing the large text?


I have a simple UITextView in my login screen where I need to display Terms & conditions.I have a very large text in Terms and Conditions.In the interface builder I have added text to the UITextView. In the interface builder the text is getting showed properly. But when I run the application the UITextView is empty. If I give small text in the UItextView it is rendering properly but huge/large text is not getting displayed.


Here is the code.

- (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.
}

Solution

  • I also had faced the same problem and i solved it my taking IBOutlet of UITextView and setting the value in the code like this

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

    Another option can be take a webview and load your contents in webview.