UIButton *checkbox; BOOL Checkboxselected;checkbox= [[UIButton alloc] Initwithframe:cgrectmake (x, Y, -, -)//20x20 is the size of the Checckbox so you want//Create 2 images sizes 20x20, one empty square and//another of the same square with the checkmark in it//Create 2 uiimages with these new images and then:[checkbox setbackgroundimage:[uiimage imagenamed:@"Notselectedcheckbox.png"] Forstate:uicontrolstatenormal]; [CheckBox setbackgroundimage:[uiimage imagenamed:@"Selectedcheckbox.png"] forstate:uicontrolstateselected]; [CheckBox setbackgroundimage:[uiimage imagenamed:@"Selectedcheckbox.png"] forstate:uicontrolstatehighlighted];checkbox.adjustsimagewhenhighlighted=YES; [CheckBox AddTarget ...] [Self.view Addsubview:checkbox];
Now in the target method do the following:
-(void) checkboxselected: (ID) sender { /**/ [ CheckBox setselected:checkboxselected];}
CheckBox in IOs