iOS7 風格 UISwitch 控件:ZJSwitch

jopen 10年前發布 | 61K 次閱讀 ZJSwitch iOS開發 移動開發

ZJSwitch 實現具有 iOS7 風格 UISwitch 控件,可在Switch上顯示定制文字。

687474703a2f2f6a616d65737a6a68652e71696e6975646e2e636f6d2f7a6a737769746368.png

使用方法:

    ZJSwitch *switch0 = [[ZJSwitch alloc] initWithFrame:CGRectMake(100, 100, 60, 31)];
    switch0.backgroundColor = [UIColor clearColor];
    [switch0 addTarget:self action:@selector(handleSwitchEvent:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:switch0];

    ZJSwitch *switch1 = [[ZJSwitch alloc] initWithFrame:CGRectMake(100, 140, 60, 31)];
    switch1.backgroundColor = [UIColor clearColor];
    switch1.tintColor = [UIColor orangeColor];
    [switch1 addTarget:self action:@selector(handleSwitchEvent:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:switch1];

    ZJSwitch *switch2 = [[ZJSwitch alloc] initWithFrame:CGRectMake(100, 180, 80, 31)];
    switch2.backgroundColor = [UIColor clearColor];
    switch2.tintColor = [UIColor orangeColor];
    switch2.onText = @"ON";
    switch2.offText = @"OFF";
    [switch2 addTarget:self action:@selector(handleSwitchEvent:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:switch2];

項目主頁:http://www.baiduhome.net/lib/view/home/1402827873685

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!