可能重复:
xcode iOS 比较字符串
试图让 UIImageview 根据用户的位置(城市)显示不同的图像,这是我得到的代码:
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"Found placemarks: %@, error: %@", placemarks, error);
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
//Display country and city
country.text = [NSString stringWithFormat:placemark.country];
city.text = [NSString stringWithFormat:placemark.locality];
if (placemark.locality==@"Cupertino")
banner.image = [UIImage imageNamed:@"cupertino.png"];
} else {
NSLog(@"%@", error.debugDescription);
}
} ];
我可以让标签显示国家和城市,但不能让 UIImageview 根据城市改变,有什么想法吗?