У меня возникли проблемы с подключением переменных экземпляра в редакторе визуальных объектов с использованием Xcode4.
удалось подключить делегат приложения Whereami к mapView и ActivityIndicator, но по какой-то причине не удалось найти locationTitleField. У меня также возникают проблемы с подключением делегатов к делегату приложения.
Что я делаю не так?
Вот код приложения Whereami App Delegate.h:
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
@interface WhereamiAppDelegate : NSObject <UIApplicationDelegate,CLLocationManagerDelegate> {
UIWindow *window;
CLLocationManager *locationManager;
IBOutlet MKMapView *mapView;
IBOutlet UIActivityIndicatorView *activityIndicator;
IBOutlet UITextView *locationTitleField;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
Whereami App Delegate.m
#import "WhereamiAppDelegate.h"
@implementation WhereamiAppDelegate
@synthesize window=_window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
//-- Create location manager object --
locationManager = [[CLLocationManager alloc] init];
//-- Make this instance of WhereamiAppDelegate the delegate
//-- It will sends its messages to our Whereami delegate.
[locationManager setDelegate:self];
//-- We want all results from the location manager--
[locationManager setDistanceFilter:kCLDistanceFilterNone];
//-- And we want it to be as accurate as possible--
//-- Regardless of how much time/power it takes --
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
//-- Tell our location manager to start looking for its location
//-- immediately
[locationManager startUpdatingLocation];
[self.window makeKeyAndVisible];
return YES;
}
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
{
NSLog(@"Could not find location: %@", error);
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"%@", newLocation);
}