iOS UISegmentedControl 无法以编程方式定位
<p><p>我无法更改 UISegmentedControl 的位置。如果我这样做:</p>
<pre><code>segControl2.frame = CGRectMake( segControl1.origin.x, segControl2.origin.y, segControl2.size.width, segControl2.size.height);
</code></pre>
<p>什么都没有真正改变,每个人都说改变控件的框架应该可以,但事实并非如此。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>CGRect frame = [ bounds];
UISegmentedControl *segControl = [ initWithItems: initWithObjects:@"One", @"Two", @"Three", nil];
segControl.frame = CGRectMake(frame.origin.x + 50, frame.origin.y + 50, segControl.size.width, segControl.size.height);
;
</code></pre>
<p>应该可以正常工作。</p></p>
<p style="font-size: 20px;">关于iOS UISegmentedControl 无法以编程方式定位,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/15536536/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/15536536/
</a>
</p>
页:
[1]