私はテキスト(本の物語)を持っています。私はそれを表示するために UILabel を取っています。しかし、それは私を表示していません。次のコードを使用しています。
CGSize labelsize;
UILabel *commentsTextLabel = [[UILabel alloc] init];;
[commentsTextLabel setNumberOfLines:0];
commentsTextLabel.textColor = [UIColor blackColor];
[commentsTextLabel setBackgroundColor:[UIColor clearColor]];
[commentsTextLabel setFont:[UIFont fontWithName:@"ACaslonPro-Regular"size:17]];
labelsize=[story sizeWithFont:commentsTextLabel.font constrainedToSize:CGSizeMake(280, 15000) lineBreakMode:NSLineBreakByWordWrapping];
commentsTextLabel.frame=CGRectMake(20, 200, 280, labelsize.height);
commentsTextLabel.text = story;// more than 1000 lines
[self.view addSubview:commentsTextLabel];
コードをデバッグすると、13145 の場合、labelsize.height が出てくることがわかりました。それでも表示されません。15000 を 11000 に減らすと、テキストがビューに表示されて .... ついに。
labelsize=[story sizeWithFont:commentsTextLabel.font constraintToSize:CGSizeMake(280, 15000) lineBreakMode:NSLineBreakByWordWrapping];
私を助けてください。ありがとう