i write a code for contain a text into a view as
-(void)buildFrames
{
NSTextStorage *textstorege=[[NSTextStorage alloc]initWithAttributedString:self.bookMarkup];
_layoutManager =[[NSLayoutManager alloc]init];
[textstorege addLayoutManager:_layoutManager];
NSTextContainer *textcontainer=[[NSTextContainer alloc]initWithSize:CGSizeMake(self.bounds.size.width, FLT_MAX)];
[_layoutManager addTextContainer:textcontainer];
UITextView *textView = [[UITextView alloc]initWithFrame:self.bounds textContainer:textcontainer];
textView.scrollEnabled = YES;
[self addSubview:textView];
}
then error is like as Property "Bounds" not found in object type view controller...
Your line:
UITextView *textView = [[UITextView alloc]initWithFrame:self.bounds textContainer:textcontainer];
If self
is a UIViewController
or UISplitViewController
then self
doesn't have bounds it's a controller. You want the bounds of the view the controller is responsible for.
Try self.view.bounds
so your line becomes:
UITextView *textView = [[UITextView alloc]initWithFrame:self.view.bounds textContainer:textcontainer];
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加