[問題] 地圖定位

看板MacDev作者 (Blue in HL)時間12年前 (2012/11/03 22:05), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
小弟在編寫地圖定位遇到一些瓶頸, 希望有大大可以幫忙解答 最近在研究map的使用 我很簡單的只放兩個Button和map view 一個Button用來定位, 一個用來將地圖移動到設定好的目標 主要是定位出了點問題, 用模擬器Run的時候只能成功定位一次 再次點擊的時候就都沒有反應了 不知道是哪裡有問題 以下是定位部分的程式碼 - (IBAction)showLocation:(id)sender { if ([CLLocationManager authorizationStatus]== kCLAuthorizationStatusDenied) { UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"使用者沒開放" message:nil delegate:nil cancelButtonTitle:@"了解" otherButtonTitles:nil, nil]; [alertView show]; [alertView release]; } else { [m_mapView setShowsUserLocation:YES]; }} -(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { CLLocationCoordinate2D currentLocation = userLocation.coordinate; MKCoordinateSpan defaultSpan = MKCoordinateSpanMake(0.005, 0.005); [m_mapView setRegion:MKCoordinateRegionMake(currentLocation, defaultSpan) animated:YES]; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 134.208.60.34

11/03 23:25, , 1F
你期望要有什麼反應?你沒動的話本來就什麼都不會發生啊
11/03 23:25, 1F
文章代碼(AID): #1GbIIsUe (MacDev)
文章代碼(AID): #1GbIIsUe (MacDev)