这里的例子:
查看 UITableViewCell 右侧的指南针
用于CLLocationManager
获取您的位置和航向,然后计算每个坐标的相对方向。
@kyr is right, you can calculate direction BY CLLocationManager
, and about the rotated arows images, These could be static images with round background and arrow on it, everytime you calculate direction, you can rotate the Image by CGAffinetransform
and CGAffineTransformMakeRotation
.
Use CLLocationManager to get the heading.
-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
CLLocationDirection true = [newHeading trueHeading];
CLLocationDirection magnetic = [newHeading magneticHeading];
}