【代码笔记】iOS-点击任何处,出现城市

一,效果图。

二,工程目录。

三,代码。

复制代码
//点击任何处,出现城市
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UIActionSheet *city=[[UIActionSheet alloc] initWithTitle:@"城市选择" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"北京",@"上海",@"天津",@"重庆",@"哈尔滨",@"长春",@"沈阳",@"呼和浩特",@"石家庄",@"乌鲁木齐",@"兰州",@"西安",@"西宁",@"银川",@"郑州",@"济南",@"太原",@"合肥",@"武汉",@"南京",@"成都",@"贵阳",@"昆明",@"南宁",@"拉萨",@"杭州",@"南昌",@"广州",@"福州",@"台北",@"海口",@"香港",@"澳门", nil];
    city.backgroundColor=[UIColor orangeColor];
    [city showInView:self.view];
    
}
复制代码

 

原文地址:https://www.cnblogs.com/yang-guang-girl/p/5120260.html