在这里,我想修复一个 UITextView,它是我在 Storyboard上添加的 textView 中以编程方式创建的。我已经尝试过这种方式,但没有用。
_textView 是一个 textView,我必须在其中修复 UITextView *descrip
contentView 是我拥有 _textView 的 View 。
UITextView *descrip = [[UITextView alloc]init];
descrip.view.frame = CGRectMake(_textView.frame.origin.x,_textView.frame.origin.y,_textView.frame.size.width,_textView.frame.size.height);
[self.contentView addSubview:descrip.view];
最佳答案
你可以这样做--
UITextView *descrip = [[UITextView alloc]initWithFrame:_textView.frame];
[self.contentView addSubview:descrip];
如果您想提供与 _textView
frame
相同的框架,则无需使用 CGRectMake
。
关于ios - 如何修复 Storyboard TextView 中的 UITextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38028306/