One.
Two, engineering drawings.
Three, code.
RootViewController.h
#import <UIKit/UIKit.h>@interface rootviewcontroller:uiviewcontroller@end
Rootviewcontroller.m
#import"RootViewController.h"#import"NIDropDown.h"@interfaceRootviewcontroller ()@end@implementationrootviewcontroller-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) nibbundleornil{self =[Super Initwithnibname:nibnameornil Bundle:nibbundleornil];If(self) {//Custom initialization}ReturnSelf;} - (void) viewdidload{[Super Viewdidload];//Do any additional setup after loading the view.self.title=@"DropDown"; UIButton *button=[UIButton Buttonwithtype:uibuttontyperoundedrect]; Button.frame=cgrectmake (10,100,150,30); Button.backgroundcolor=[Uicolor Redcolor]; [Button addtarget:self action: @selector (doclickaction:) forcontrolevents:uicontroleventtouchupinside]; [Self.view Addsubview:button]; }-(void) Doclickaction: (UIButton *) btn{Nsarray *dataarray=[nsarray arraywithobjects:@"1",@"2@" 3 ", @" 4", @ "5" [[nidropdown alloc]init]; [DropDown showdropdown:btn andheight:[dataarray count]*36 Anddata:dataarray]; [Self.view Addsubview:dropdown];} -(void) didreceivememorywarning{[super Didreceivememorywarning]; // Dispose of any resources the can be recreated.}
Good text to the top concern me to collect the article
"Code Note" ios-dropdowndemo-drop-down button effect