Tag: uitextview nstextcontainer

如果全宽并位于textContainer顶部,则UITextView textContainer排除path将失败

在iOS 8中,我试图添加一个UIImageView作为UITextView的子视图,类似于这里显示的内容 – 但是图像下方的文本。 我想使用排除path,因为在其他设备上,我可能根据屏幕大小以不同的方式定位图像。 但是,如果用于创build排除path的CGRect的Y原点为0,并且占用了textView的全部宽度,则排除失败,并且文本显示在排除path中(这样文本显示在imageView,你可以在截图中看到)。 为了testing这个,我使用“single view”Xcode模板构build了一个简单的应用程序,其中包含以下内容: – (void)viewDidLoad { [super viewDidLoad]; // set up the textView CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); UITextView *textView = [[UITextView alloc] initWithFrame:frame]; [textView setFont:[UIFont systemFontOfSize:36.0]]; [self.view addSubview:textView]; textView.text = @"I wish this text appeared below the exclusion rect and not within it."; // add the photo […]