In our actual development we do login or registration function often need to tick a protocol this time need to use the checkbox button, checkbox is a PC or Android control iOS not, so we need to customize.
The Whc_radiobutton.h header files are as follows:
//// WHC_RadioButton.h// CTBMobileBank//// Created by 吴海超 on 15/4/1.////#import <UIKit/UIKit.h>#define KWHC_IMAGE_SIZE (15.0) //图标尺寸@interface WHC_RadioButton : UIButton@end
WHC_RADIOBUTTON.M source files are as follows:
////WHC_RADIOBUTTON.M//Ctbmobilebank////Created by Wuhaishu on 15/4/1.////#import "Whc_radiobutton.h" @implementation Whc_radiobutton //Handle button title area- (CGRect) Titlerectforcontentrect: (CGRect) contentrect{Contentrect. Origin. x= Kwhc_image_size;returnContentrect;}//Processing icon Area- (CGRect) Imagerectforcontentrect: (CGRect) contentrect{CGRectrect = Cgrectzero; Rect. Origin. x=0.0; Rect. Origin. Y= (Cgrectgetheight ( Self. Bounds)-Kwhc_image_size)/2.0; Rect. Size. Height= Kwhc_image_size; Rect. Size. Width= Kwhc_image_size;returnRect;}@end
Common custom control development sets for iOS development Series-Custom radio buttons or multi-button control development