In the actual development of many times we need to use the drop-down list, we have to implement below.
The whc_combobox.h header files are as follows:
//// WHC_ComboBox.h// WHC_ComboBox//// Created by 吴海超 on 15/4/2.////#import <UIKit/UIKit.h>@interface WHC_ComboBox : UIButton@end
WHC_COMBOBOX.M source files are as follows:
////WHC_COMBOBOX.M//Whc_combobox////Created by Wuhaishu on 15/4/2.////#import "whc_combobox.h" #define KWHC_PADING (5.0)//Picture margin @implementation whc_combobox //Load Xib- (void) awakefromnib{ Self. Layer. BorderColor= [UicolorBlackcolor]. Cgcolor; Self. Layer. BorderWidth=0.5;}//Processing header area- (CGRect) Titlerectforcontentrect: (CGRect) contentrect{Contentrect. Origin. x=1.0;returnContentrect;}//Processing icon Area- (CGRect) Imagerectforcontentrect: (CGRect) contentrect{CGRectrc = Cgrectzero;CGFloatwidth = cgrectgetheight (contentrect)-2.0* kwhc_pading; Rc. Origin. x= Cgrectgetwidth (contentrect)-width-kwhc_pading; Rc. Origin. Y= kwhc_pading; Rc. Size. Width= width; Rc. Size. Height= width;returnRC;}@end
Common custom control development sets for iOS development series-Custom multi-select button control development