本文介绍了IOS下拉选项cell的使用方法,供大家参考,具体内容如下
一、效果图
二、工程图
三、代码
RootViewController.h
#import <UIKit/UIKit.h>
//加入头文件
#import "ComboBoxView.h"
@interface RootViewController : UIViewController
{
ComboBoxView *_comboBox;
}
@end
RootViewController.m
#import "RootViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationController.navigationBarHidden=YES;
NSArray *comboBoxDatasource = [[NSArray alloc] initWithObjects:@"one", @"two", @"three", @"four", @"five", @"six", @"seven", @"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];
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持得得之家。
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!