开发者

finding current location in iphone

trying add annotation on current location when ever i want Any number of annotation at the but it work can any help me out i try this code

 - (CLLocationCoordinate2D)coordinate;
{
    CLL开发者_运维问答ocationCoordinate2D theCoordinate;
    theCoordinate.latitude =MKUserLocation.latitude;          //37.786996;// Here we have to change the with current location  
    theCoordinate.longitude = MKUserLocation.longitude;
    return theCoordinate; 
}


Make use of CLLocationManagerDelegate method

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation


[map setShowsUserLocation:TRUE];

map is the object of MKMapView.


Use this delegate method

-(void)locationManager:(CLLocationManager *)manager
        didUpdateToLocation:(CLLocation *)newLocation
               fromLocation:(CLLocation *)oldLocation {

        if (userLocation_) {
            [userLocation_ release];
        }
        userLocation_ = [newLocation retain];
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜