0

Below code gives me the location of US. How can i find the location of UK using the same Code help?

#import "LocalWeatherViewController.h"
#import "ICB_WeatherConditions.h"
#import "MapKit/MapKit.h"

@implementation LocalWeatherViewController

@synthesize currentTempLabel, highTempLabel, lowTempLabel, conditionsLabel, cityLabel;
@synthesize conditionsImageView;
@synthesize conditionsImage;

- (void)viewDidLoad {
    [super viewDidLoad];

    if (1)

        {

        CLLocationCoordinate2D coord;
        coord.latitude = 45.574779;
        coord.longitude = -122.685366;


        MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
        geocoder.delegate = self;
        [geocoder start];
    }
    else
    {

        [self performSelectorInBackground:@selector(showWeatherFor:) withObject:@"97217"];
    }
}

- (void)showWeatherFor:(NSString *)query
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    ICB_WeatherConditions *weather = [[ICB_WeatherConditions alloc] initWithQuery:query];

    [self.currentTempLabel setText:[NSString stringWithFormat:@"%d", weather.currentTemp]];
    [self.highTempLabel setText:[NSString stringWithFormat:@"%d", weather.highTemp]];
    [self.lowTempLabel setText:[NSString stringWithFormat:@"%d", weather.lowTemp]];
    [self.conditionsLabel setText:weather.condition];
    [self.cityLabel setText:weather.location];

    self.conditionsImageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:weather.conditionImageURL]];

    [weather release];

    [pool release];
}


- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
    [geocoder release];
    [self performSelectorInBackground:@selector(showWeatherFor:) withObject:    [placemark.addressDictionary objectForKey:@"ZIP"]];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
    NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error);
    [geocoder release];
}

- (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {

}

- (void)dealloc {
    [super dealloc];
}

@end
ThomasRS
  • 8,215
  • 5
  • 33
  • 48
N15H4NJ0
  • 33
  • 3
  • It is very hard to figure out what you actually want. Please try and state your question more clearly. –  Apr 08 '11 at 00:54
  • it's to find the current weather condition and to find the city name – N15H4NJ0 Apr 08 '11 at 00:59
  • that doesn't help much, either. if you hard code the coordinates in your program, why don't you simple hard code the city name instead? also, the else clause is never reached, so no wheather… –  Apr 08 '11 at 01:07
  • note that you can update your original question. –  Apr 08 '11 at 01:08

1 Answers1

-1

Try latitude = 50.5, longitude = 0

SVD
  • 4,743
  • 2
  • 26
  • 38
  • If he wants an MKPlacemark in the UK, he can simply create one. No need to do stupid dances with reverse geo coding. –  Apr 08 '11 at 00:56