更改UISwitch的宽度和高度 [英] Changing UISwitch width and height

查看:139
本文介绍了更改UISwitch的宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图更改iOS中UISwitch元素的默认高度和宽度,但未成功.

I am trying to change the default height and width of a UISwitch element in iOS, but unsuccessfully.

您可以更改UISwitch元素的默认高度和宽度吗?
应该以编程方式创建元素吗?

Can you change the default height and width of a UISwitch element?
Should the element be created programmatically?

推荐答案

我测试了该理论,看来您可以使用scale transform来增大UISwitch

I tested the theory and it appears that you can use a scale transform to increase the size of the UISwitch

UISwitch *aSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(120, 120, 51, 31)];
aSwitch.transform = CGAffineTransformMakeScale(2.0, 2.0);
[self.view addSubview:aSwitch];

这篇关于更改UISwitch的宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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