Текст UITextView не начинается сверху

У меня есть UITextView. Я хочу, чтобы его текст начинался сверху, но я не сверху. Пожалуйста, взгляните на мой код:

UITextView *myTextView = [[UITextView alloc] init];
myTextView.frame = rect;
myTextView.editable = NO;
myTextView.font = [UIFont fontWithName:@"Helvetica" size:MAIN_FONT_SIZE];
myTextView.backgroundColor = [UIColor clearColor];
myTextView.text = sourceNode.label;
myTextView.dataDetectorTypes = UIDataDetectorTypeAll;
[cell.contentView addSubview:myTextView];
[myTextView sizeToFit];
[self alignTextToTopTextView:myTextView]; 

alignTextToTopTextView:

-(void)alignTextToTopTextView :(UITextView*)textView{

    CGRect frame = textView.frame;
    frame.size.height = textView.contentSize.height;
    textView.frame = frame;
} 

Пожалуйста, посмотрите на скриншот ниже.

UITextViewнаходится справа.

enter image description here

45
задан halfer 29 August 2017 в 22:13
поделиться