实现效果
在写界面的时候遇到了下拉框问题,最后效果如下:
实现
总代码
在ViewController.m中
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property NSInteger flag;
@property NSMutableArray *array;
@property UITableView *tableView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor grayColor];
_flag = 0;
_tableView = [[UITableView alloc]initWithFrame:CGRectMake(60, 150, 150, 44) style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.separatorStyle = UITableViewCellSelectionStyleNone;
[self.view addSubview:_tableView]