代码库> 列表> 中国城市列表选择OC版
中国城市列表选择OC版
关注
上传者:zjqnzb 分类:列表(Tableview Collection)
查看次数:7078 下载次数:1843
上传时间:2015-10-27 大小:174 B
自己写了一个选择城市的DEMO,时间比较仓促,写的不是很好。具体用法如下:






#import "ViewController.h"
#import "CityListViewController.h"
@interface ViewController ()<CityListViewDelegate>
@property (weak, nonatomic) IBOutlet UIButton *button;


@end


@implementation ViewController


- (void)viewDidLoad {
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)selectCityAction:(UIButton *)sender {

CityListViewController *cityListView = [[CityListViewController alloc]init];
    cityListView.delegate = self;
//热门城市列表
    cityListView.arrayHotCity = [NSMutableArray arrayWithObjects:@"广州",@"北京",@"天津",@"厦门",@"重庆",@"福州",@"泉州",@"济南",@"深圳",@"长沙",@"无锡", nil];
//历史选择城市列表
    cityListView.arrayHistoricalCity = [NSMutableArray arrayWithObjects:@"福州",@"厦门",@"泉州", nil];
//定位城市列表

    cityListView.arrayLocatingCity   = [NSMutableArray arrayWithObjects:@"福州", nil];
    [self presentViewController:cityListView animated:YES completion:nil];

}


- (void)didClickedWithCityName:(NSString*)cityName
{
    [_button setTitle:cityName forState:UIControlStateNormal];
}
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部