nstextcontainer

What is Causing this Unwanted Content Inset with UITextView in iOS 8 (not there in iOS 7)?

天大地大妈咪最大 提交于 2019-11-30 15:06:18
I've been creating UITextView s programatically, using auto layout, in iOS 7. Something like this: _textView = [UITextView new]; _textView.translatesAutoresizingMaskIntoConstraints = NO; _textView.font = [UIFont systemFontOfSize:18.0]; _textView.delegate = self; [self.view addSubview:_textView]; In addition to the other constraints I've created, I have this one for the bottom of the text view: _textViewBottomConstraint = [NSLayoutConstraint constraintWithItem:_textView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop

UITextView textContainer exclusion path fails if full width and positioned at top of textContainer

放肆的年华 提交于 2019-11-30 11:46:34
In iOS 8, I'm trying to add a UIImageView as a subview of a UITextView, similar to what's shown here - but with the text below the image. I want to do it using an exclusion path because on other devices, I might position the image differently depending on the screen size. However there's a problem where if the CGRect used to create the exclusion path has a Y origin of 0, and takes up the full width of the textView, the exclusion fails and the text appears within exclusion path (so that the text is shown behind the imageView, as you can see in that screenshot). To test this I built a simple app

What is Causing this Unwanted Content Inset with UITextView in iOS 8 (not there in iOS 7)?

有些话、适合烂在心里 提交于 2019-11-29 21:47:12
问题 I've been creating UITextView s programatically, using auto layout, in iOS 7. Something like this: _textView = [UITextView new]; _textView.translatesAutoresizingMaskIntoConstraints = NO; _textView.font = [UIFont systemFontOfSize:18.0]; _textView.delegate = self; [self.view addSubview:_textView]; In addition to the other constraints I've created, I have this one for the bottom of the text view: _textViewBottomConstraint = [NSLayoutConstraint constraintWithItem:_textView attribute

UITextView textContainer exclusion path fails if full width and positioned at top of textContainer

喜欢而已 提交于 2019-11-29 17:08:19
问题 In iOS 8, I'm trying to add a UIImageView as a subview of a UITextView, similar to what's shown here - but with the text below the image. I want to do it using an exclusion path because on other devices, I might position the image differently depending on the screen size. However there's a problem where if the CGRect used to create the exclusion path has a Y origin of 0, and takes up the full width of the textView, the exclusion fails and the text appears within exclusion path (so that the

Using a CALayer to highlight text in a UITextView which spans multiple lines

隐身守侯 提交于 2019-11-28 20:38:09
问题 This is a continuation of Getting CGRect for text in a UITextView for the purpose of highlighting with a CALayer. I'm having trouble with getting the correct rectangle for the ranges in each line fragment. NSString* searchString = @"Returns the range of characters that generated"; NSRange match = [[[self textView]text]rangeOfString:searchString]; NSRange matchingGlyphRange = [manager glyphRangeForCharacterRange:match actualCharacterRange:NULL]; [manager enumerateLineFragmentsForGlyphRange