This paper introduces the use of the iOS dropdown option cell for your reference, the details are as follows
One, the effect chart
Second, engineering drawing
Third, the Code
RootViewController.h
#import <UIKit/UIKit.h>
//Join header file
#import "ComboBoxView.h"
@interface Rootviewcontroller: Uiviewcontroller
{
comboboxview *_combobox;
}
@end
Rootviewcontroller.m
#import "RootViewController.h" @interface Rootviewcontroller () @end @implementation R Ootviewcontroller-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil {self = [super init
Withnibname:nibnameornil Bundle:nibbundleornil];
if (self) {//Custom initialization} return self;
}-(void) viewdidload {[Super viewdidload];
Do no additional setup after loading the view.
Self.navigationcontroller.navigationbarhidden=yes; Nsarray *comboboxdatasource = [[Nsarray alloc] initwithobjects:@ "One", @ "two", @ "three", @ "four", @ "five", @ "six", @ "Seve"
n ", @" eight ", nil];
_combobox = [[Comboboxview alloc] Initwithframe:cgrectmake (20, 20, 280, 140)];
_combobox.comboboxdatasource = Comboboxdatasource;
_combobox.backgroundcolor = [Uicolor Clearcolor];
[_combobox Setcontent:[comboboxdatasource objectatindex:0]];
[Self.view Addsubview:_combobox]; }
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.