gpt4 book ai didi

ios - 如何在UITextView中设置UIView

转载 作者:行者123 更新时间:2023-11-29 01:26:00 29 4
gpt4 key购买 nike

下图显示TextView里面有一个view。现在我希望 UIView 从那里结束,textview 开始编辑,不仅从左上角也从左下角开始。

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;

enter image description here

最佳答案

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];

关于ios - 如何在UITextView中设置UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34014952/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com