如何更改UISegmentedControl的角半径? [英] How to change the corner radius of UISegmentedControl?

查看:94
本文介绍了如何更改UISegmentedControl的角半径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改UISegmentedControl的拐角半径?我尝试了下面的方法,我们用来更改UIView的角半径。

Is it possible to change the corner radius of UISegmentedControl? I have tried the following approach which we use to change a UIView's corner radius.

    self.segmentedControl.layer.cornerRadius = 15.0;
    self.segmentedControl.layer.masksToBounds = YES;

这没有工作,你可以看到它只切断UISegmentedControl的角落。

This did not work as you can see it only cuts off the UISegmentedControl's corner.

谢谢!

推荐答案

分段控件不会改变它绘制角的方式,所以它继续画它的角它自己的方式,你然后切断他们。你不负责分段控件如何绘制其边界形状。如果你真的不喜欢它的绘制方式,你必须从头开发自己的替代控件。你可以合法地来到你想要做的事情最接近的是设置分段控件的背景图片。

The segmented control is not going to change the way it draws its corners, so it is continuing to draw its corners in its own way and you are then cutting them off. You are not in charge of how a segmented control draws its boundary shape. If you truly don't like the way it's drawn, you'll have to devise your own substitute control from scratch. The closest you can legitimately come to the kind of thing you're trying to do is to set the segmented control's background image.

这篇关于如何更改UISegmentedControl的角半径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆