从网上找的demo,根据自己的项目需求进行改进写的城区选择器,传值采用的是代理方式,只需要以下几行代码就可以创建
CityListViewController *cityListVC = [[CityListViewController alloc]init];
cityListVC.delegate = self;
//热门城市列表
cityListVC.arrayHotCity = [NSMutableArray arrayWithObjects:@"北京",@"上海",@"广州",@"厦门",@"深圳",@"天津",@"长沙",@"郑州", nil];
//历史选择城市列表
cityListVC.arrayHistoricalCity = [NSMutableArray arrayWithObjects:@"北京",@"上海",@"广州",nil];
//定位城市列表
cityListVC.arrayLocatingCity = [NSMutableArray arrayWithObjects:_boundCity, nil];
cityListVC.view.backgroundColor = [UIColor whiteColor];
[self presentViewController:cityListVC animated:YES completion:nil];