我在categories table
内有一个UITextView
。我在
UITableViewCell
我的顶部和底部有额外的像素。我想删除它。我做了什么:
1)我if ([keyPath isEqualToString:@"noteTextView.text"]) {
[self setExcludedPaths];
if (self.noteTextView.text.length > 0) {
CGSize sizeThatFitsTextView = [self.noteTextView sizeThatFits:CGSizeMake(self.noteTextView.frame.size.width, MAXFLOAT)];
self.noteTextViewHeightConstraint.constant = sizeThatFitsTextView.height;
} else {
self.noteTextViewHeightConstraint.constant = 0.f;
}
}
self.automaticallyAdjustsScrollViewInsets = NO;
2)在UIViewController
UITextView
如果我将- (void)awakeFromNib
{
[super awakeFromNib];
self.font = [UIFont fontWithName:@"HelveticaNeue" size:16.f];
self.textColor = [UIColor noteTextColor];
self.textContainerInset = UIEdgeInsetsZero;
//self.contentMode = UIViewContentModeTop;
self.contentInset = UIEdgeInsetsMake(0, -5, 0, 0);
self.backgroundColor = [UIColor redColor];
self.scrollEnabled = NO;
}
文字移到顶部,但底部的额外空格仍然存在
请帮帮我。
答案 0 :(得分:0)
如果我设置UIEdgeInsetsMake(-4,-5,0,0);文本移到顶部,但底部的额外空间仍然存在
所以你可以试试UIEdgeInsetsMake(-4,0,-5,0)。
答案 1 :(得分:0)
将此用于空间
yourTextField.layer.sublayerTransform = CATransform3DMakeTranslation(35, 0, 0);
如果您想删除字词之间的空格
尝试
NSString *newString = [yourString stringByReplacingOccurrencesOfString:@" " withString:@""];