
本文共 2371 字,大约阅读时间需要 7 分钟。
UISwitch ������������������������������������������ UI ��������������������������������������������������������������������� frame ��������������������������������������������������������������������������������������������������������� 150x50 ��� 200x75������������������������������������������������ UI ���������������������
������ Core Graphics ��� affine ��������������������������� UISwitch ��������������������������������������������������������������������������� CGAffineMakeScale(1.2, 1.2) ������������������������������������������������
������������
UISwitch ���������������������������������������������������������������������
������ | ������ |
---|---|
on | ������������������������������������������������������ |
onTintColor | ������������������������������������ |
tintColor | ������������������������������������ |
thumbTintColor | ������������������������������ |
backgroundColor | ������������������������������ |
cornerRadius | ��������������������������������������� nil��� |
masksToBounds | ��������������������������������������� YES��� |
enabled | ������������������������������������������ YES��� |
checked | ������������������������������������������ on ��������������� |
���������������
��������������������� UISwitch ������������������������������������������������
-(UISwitch*) makeCustomSwitch { UISwitch* customSwitch = [[UISwitch alloc] init]; [customSwitch layer setCornerRadius:15.0]; [customSwitch layer setMasksToBounds:YES]; customSwitch.backgroundColor = [UIColor orangeColor]; customSwitch.onTintColor = [UIColor magentaColor]; customSwitch.tintColor = [UIColor blackColor]; customSwitch.thumbTintColor = [UIColor blueColor]; return customSwitch;}
������������
������������ UISwitch ������������������������������ addTarget ���������������
[switch addTarget:self action:@selector(onSwitchValueChange:) forControlEvents:UIControlEventTouchUpInside];
������������������������������������������
-(void) onSwitchValueChange: (UISwitch*)sender { // ������������������������}
������������
������������������������
������������������������������������������������������������������������������
发表评论
最新留言
关于作者
