gpt4 book ai didi

ios - 如何修复 Storyboard TextView 中的 UITextView

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

在这里,我想修复一个 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/

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