ios - 将 UILabel 添加到 UITextView
<p><p>我有多个 <code>UITextView</code> 是我使用 for 循环以编程方式创建的。我正在尝试将 <code>UILabel</code> 添加到每个 <code>UITextView</code> 的左上角。
我该怎么做?</p>
<p>我的 <code>UITextView</code> 代码:</p>
<pre><code>for (int i = 0; i < 10; i++){
UITextView *textView = [ initWithFrame:CGRectMake(0, yPos, 375,height)];
]; //set different property like this
UIColor *borderColor = ;
textView.layer.borderColor = borderColor.CGColor;
textView.layer.borderWidth = 1.0;
textView.layer.cornerRadius = 5.0;
textView.textAlignment=NSTextAlignmentRight;
textView.editable=NO;
;
// CommentScroll Is the name of my viewcontroller
yPos += (height + padding);
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>Objective-c 代码:-</p>
<pre><code>UILabel *cust_Label = [ initWithFrame:CGRectMake(Your_X, Your_Y, Your_Width,Your_Height)];
cust_Label.text=@"Your Text";
;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 将 UILabel 添加到 UITextView,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37032070/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37032070/
</a>
</p>
页:
[1]