我創建了一個應用程序,我想在其中顯示指南針,但是我的應用程序正在向我顯示空白頁..我還添加了CoreLocation框架..請幫助我顯示指南針。指南針不在iPhone中顯示
.h文件中的代碼:
import "UIKit/UIKit.h"
import "CoreLocation/CoreLocation.h"
@interface Compass_VIew : UIViewController<CLLocationManagerDelegate>
{
IBOutlet UIImageView *arrow;
IBOutlet UIImageView *arrowC;
CLLocationManager *locManager;
}
@property (nonatomic, retain) CLLocationManager *locManager;
@property(readonly, nonatomic) BOOL headingAvailable;
@end
.m文件代碼
didUpdateHeading方法代碼:
NSLog(@"New magnetic heading: %f", newHeading.magneticHeading);
NSLog(@"New true heading: %f", newHeading.trueHeading);
viewDidLoad方法代碼:
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[[self navigationController] setNavigationBarHidden:NO animated:NO];
locManager = [[[CLLocationManager alloc] init] autorelease];
locManager.desiredAccuracy= kCLLocationAccuracyBest;
locManager.delegate = self;
[self.locManager startUpdatingHeading];
是它給予任何錯誤或警告? – 2012-04-10 06:14:47