Milan1111
Milan1111

Reputation: 185

UITextView cuts in the middle

I am having a problem with UITextView. On simulator it shows me the UITextView normally without any cut but when I run the project on real device, I am getting the cut in the middle.

self.popisakce.text = [self.objc objectForKey:@"Class"];
        [self.popisakce sizeToFit]; //added
        [self.popisakce layoutIfNeeded]; //added
        [self.popisakce sizeToFit];
        CGRect frame = self.popisakce.frame;
            CALayer *imageLayerRRR = self.popisakce.layer;
            [imageLayerRRR setCornerRadius:5];
            [imageLayerRRR setMasksToBounds:YES];

            UIScrollView* scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0,25,768, 900)];
            scrollview.showsVerticalScrollIndicator=YES;
            scrollview.scrollEnabled=YES;
            scrollview.userInteractionEnabled=YES;
            [self.view addSubview:scrollview];
            scrollview.contentSize = CGSizeMake(768,frame.size.height+770);

Below is my output:

link

Upvotes: 0

Views: 133

Answers (2)

Vincent
Vincent

Reputation: 4409

When you put text in a UITextView which is not visible, it may not be fully displayed.

Try moving the line self.popisakce.text = [self.objc objectForKey:@"Class"]; lower in the code flow.

Upvotes: 1

Milan1111
Milan1111

Reputation: 185

[textView setScrollEnabled:NO]; fixed the problem.

Upvotes: 0

Related Questions