本文介绍了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];
}
您可能感兴趣的文章:iOS模仿电子书首页实现书架布局样式Android编程之书架效果背景图处理方法android书架效果实现原理与代码IOS代码笔记之网络嗅探功能IOS代码笔记之勾选"记住密码"整体buttonIOS代码笔记之左右滑动效果IOS实现选择城市后跳转Tabbar效果IOS代码笔记之下拉菜单效果Android实现阅读APP平移翻页效果IOS代码笔记之仿电子书书架效果