0
我想在iphone 3gs或iphone4中制作像罗盘一样的视图。你知道有人可以从头开始吗?我找不到太多关于这个问题的信息......我只想总是在北方画一个箭头。 我使用的是iOS 4.0如何在ios4中绘制像iphone 3gs的指南针?
在此先感谢
我想在iphone 3gs或iphone4中制作像罗盘一样的视图。你知道有人可以从头开始吗?我找不到太多关于这个问题的信息......我只想总是在北方画一个箭头。 我使用的是iOS 4.0如何在ios4中绘制像iphone 3gs的指南针?
在此先感谢
开始走向更新:
if([CLLocationManager headingAvailable]) {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
// myDelegateObject is an instance of a class implementing the CLLocationManagerDelegate protocol
locationManger.delegate = myDelegateObject;
[locationManager startUpdatingHeading];
}
实现你的类之一的CLLocationManagerDelegate协议 - 尤其是这样的:
-(void)locationManager:(CLLocationManager*)manager didUpdateHeading:(CLHeading*)heading {
// CLLocationDirection is a double typedef
CLLocationDirection headingInDegrees = heading.magneticHeading;
// you'll have to implement this in some fashion...
[myCompassViewController rotateCompassImageToHeading:headingInDegrees];
}