如何在 UITextView 中设置 UIView
How to set UIView inside UITextView
下图显示TextView里面有一个view。现在我想要 UIView 从那里结束的文本视图开始编辑,不仅从左上角也从左下角开始编辑。
How to do it ?
Is it possible ?
If Yes, then how ?
If no, then any other suggestion ?
如果在下方提交的文本代码用于左填充
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 20)];
textField.leftView = paddingView;
textField.leftViewMode = UITextFieldViewModeAlways;
You can wrap textfiled using below code
UIBezierPath * imgRect = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 30, 30)];
self.textView.textContainer.exclusionPaths = @[imgRect];
And, now you can add any control in place of "imgRect"
UIView *spacerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
spacerView1.backgroundColor = [UIColor redColor];
[textView addSubview:spacerView1];
下图显示TextView里面有一个view。现在我想要 UIView 从那里结束的文本视图开始编辑,不仅从左上角也从左下角开始编辑。
How to do it ?
Is it possible ?
If Yes, then how ?
If no, then any other suggestion ?
如果在下方提交的文本代码用于左填充
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 20)];
textField.leftView = paddingView;
textField.leftViewMode = UITextFieldViewModeAlways;
You can wrap textfiled using below code
UIBezierPath * imgRect = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 30, 30)];
self.textView.textContainer.exclusionPaths = @[imgRect];
And, now you can add any control in place of "imgRect"
UIView *spacerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
spacerView1.backgroundColor = [UIColor redColor];
[textView addSubview:spacerView1];