2010-08-02 4 views

답변

1

시작 제목 업데이트 :

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]; 
} 
관련 문제