我想在UIButton
内添加UITextView
和UITextView
。单击“输入”按钮后,UIView
高度会发生变化。我希望带有图像的UIBezierPath * imgRect = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 50, 50)];
self.commentText.textContainer.exclusionPaths = @[imgRect];
UIImageView *spacerView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
spacerView.image = _pickedImageForComment;
UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
[cancelButton addTarget:self
action:@selector(buttonsClicked:)
forControlEvents:UIControlEventTouchUpInside];
cancelButton.frame = CGRectMake(30, 0, 19, 19);
[cancelButton setImage:[UIImage imageNamed:@"remove_image"] forState:UIControlStateNormal];
[spacerView addSubview:cancelButton];
[_commentText addSubview:spacerView];
和取消按钮放在文本上方。有可能吗?
我尝试过使用Bezier路径。但是我的图像与文本一致,但我想让我的文字进入下一行。当我在此方法中添加按钮时,该按钮也不可用。
{{1}}