iOS UISwitch控件
发布日期:2021-05-14 01:35:53 浏览次数:16 分类:精选文章

本文共 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 {
// ������������������������
}

������������

������������������������

  • ��������������������������������������������� UISwitch ������������������������������
  • ���������������������������������������������scalableCopy������������������������������������
  • ��������������������������������������������������� UI ������������������
  • ������������������������������������������������������������������������������

    上一篇:iOS UIPageControl和UISegmentedControl控件
    下一篇:Android 文件系统与Android11 分区存储

    发表评论

    最新留言

    初次前来,多多关照!
    [***.217.46.12]2025年04月26日 09时40分04秒