我有一個包含的MKMapView
位置狀態欄圖標不會消失 - 的MKMapView - 的iOS 6.1
@property(nonatomic, weak) IBOutlet MKMapView *ibMapView;
實例類雖然我也是在項目中使用的CLLocationManager
單一實例在其他地方,我發現這個地圖視圖負責顯示iPhone狀態欄上的「位置」圖標。
具體來說,該代碼是難辭其咎:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// If I comment out this line below, the "Location" status icon never shows, as expected
self.ibMapView.showsUserLocation = YES;
// ...other magical stuff happens here, not related to map view
}
我試過設置showsUserLocation
到沒有這樣
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.ibMapView.showsUserLocation = NO;
// I also have tried logging to make sure showUserLocation is set to NO- returns "NO" as expected
DebugLog(@"Show User Location: %@", self.ibMapView.showsUserLocation ? @"YES" : @"NO");
// ...other stuff happens here, not related to map view...
}
但是,位置狀態圖標仍然顯示......它永遠不會變成即使經過一個小時後...
如何獲取位置狀態圖標,該圖標是由上的將showUserLocation
設置爲YES所致é走開?
does' - (void)viewWillDisappear:(BOOL)animated'getting called?你有沒有嘗試過任何日誌' - (void)viewWillDisappear:(BOOL)animated' – rakeshNS 2013-02-26 06:49:12
感謝您的迴應。是的,'viewWillDisappear:'被調用,通過將日誌放入其中進行驗證(請參閱更新後的問題)。 – 2013-02-26 06:55:55