项目中需要用到一个位置搜索的功能。没有找到开源的项目就自己写了一个。 模仿iOS自带日历程序中位置搜索界面和功能。可以很方便的集成。轻松得到用户搜索的位置信息。
- 将HGLocationSearch文件夹添加到你的项目中。
- 添加相关类库
- MapKit.framework
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
HGLocationSearchViewController *vc = [(id)[segue.destinationViewController viewControllers] firstObject];
vc.delegate = self;
}
#pragma mark - Delegate
#pragma mark HGLocationSearchViewControllerDelegate
- (void)locationSearchViewControllerDidSelect:(id)sender name:(NSString *)name address:(NSString *)address {
self.nameLabel.text = name;
self.addressLabel.text = address;
[self.presentedViewController dismissViewControllerAnimated:YES completion:^{
}];
}- 最近搜索的纪录
#License MIT
