This is what I have so far
my .h file
#import < UIKit/UIKit.h>
#import < CoreLocation/CoreLocation.h>
@interface WebViewController : UIViewController {
IBOutlet UIWebView *webView;
IBOutlet CLLocationManager *locationManager;
IBOutlet NSString *latitude;
IBOutlet NSString *longitude;
}
@property (nonatomic, retain) UIWebView *webView;
@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, retain) NSString *longitude;
@property (nonatomic, retain) NSString *latitude;
@end
my .m file
#import "WebViewController.h"
@implementation WebViewController
@synthesize webView;
@synthesize locationManager;
@synthesize longitude;
@synthesize latitude;
- (void) viewDidLoad {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // send location updates to this object
[self.locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSLog(@"Your location: %@", [newLocation description]);
NSString *query = [[NSString alloc] initWithFormat:
@"http://mysite.com/ihome.php?uid=%@&longitude=%d&latitude=%d",
[[UIDevice currentDevice] uniqueIdentifier],
@"&year=2010%@",
newLocation.longitude,
newLocation.latitude];
NSURL *url = [[NSURL alloc] initWithString:query];
NSURLRequest *requestObj = [ NSURLRequest requestWithURL: url ];
webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
[webView loadRequest: requestObj ];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)dealloc {
[ webView release ];
[ latitude release ];
[ longitude release ];
[ locationManager release];
[ super dealloc ];
}
@end
Do I need to add anything to IB?