IOS: check box Use---Third-party framework Sscheckboxview-master

Source: Internet
Author: User

You can choose to use a third-party open-source class library Sscheckboxview when you set up your application in iOS development in general with Uiswitch, which occasionally appears monotonous.

Sscheckboxview is a check box available on iOS UI control that provides check and uncheck two cases, and 5 styles, such as

Github:https://github.com/ardalahmet/sscheckboxview

The encapsulated Sscheckboxview is also very simple to use, first initialize its frame, set the display style and whether it is selected, and then add to the view to complete the display of a check box

-(void) viewdidload{    [Super Viewdidload];      *CB = [[Sscheckboxview alloc] Initwithframe:cgrectmake (checked  : YES];    [Self.view ADDSUBVIEW:CB];}

Five kinds of display style, the time to pass the parameter can also pass 0-5 between the number setting display style

typedef enum SSCHECKBOXVIEWSTYLE_ {    ksscheckboxviewstylebox = 0,    Ksscheckboxviewstyledark,    Ksscheckboxviewstyleglossy,    Ksscheckboxviewstylegreen,    Ksscheckboxviewstylemono,    Ksscheckboxviewstylescount} Sscheckboxviewstyle;

If you need to explain what the check box is for, set the text to fit, but the width of the Sscheckboxview object needs to be adapted, the width is too short to be displayed completely, the check box can be observed in two ways, one is to use the selected device, the other is to use block;
- (void) viewdidload{[Super Viewdidload]; Sscheckboxview*CB = [[Sscheckboxview alloc] Initwithframe:cgrectmake ( -, -, -, -) Style:ksscheckboxviewstylemonochecked: YES]; [CB SetText:@"What is this?"];    [CB setstatechangedtarget:self selector: @selector (checkboxviewchangedstate:)];            [Self.view ADDSUBVIEW:CB]; Sscheckboxview*CB2 = [[Sscheckboxview alloc] Initwithframe:cgrectmake ( -, the, -, -) Style:3 checked: YES]; [CB2 setText:@"use block to see if a check is selected"]; [CB2 setstatechangedblock:^ (Sscheckboxview *CBV) {NSLog (@"check box status:%@", CBV.checked?@"selected":@"not selected");    }];    [Self.view ADDSUBVIEW:CB2]; }-(void) Checkboxviewchangedstate: (sscheckboxview*) cbv{NSLog (@"check box status:%@", CBV.checked?@"selected":@"not selected");}

:




IOS: check box Use---Third-party framework Sscheckboxview-master

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.