簡體   English   中英

位置狀態欄圖標不會消失-MKMapView-iOS 6.1

[英]Location Status Bar Icon Won't Disappear - MKMapView - iOS 6.1

我有一個包含MKMapView實例的類

@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設置為NO,就像這樣

- (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...
}

但是,位置狀態圖標仍顯示...即使經過一個小時,它也永遠不會關閉...

如何將MKMapView實例上的showUserLocation設置為YES導致的位置狀態圖標消失?

事實證明,這是蘋果框架中的一個錯誤……

查看此問題和選擇的答案以獲取解決方案:

在調用stopUpdatingLocation之后,位置指示器在狀態欄上仍然存在,但僅適用於舊的捆綁包標識符

本質上,如果您重置位置和隱私 (設置->常規->重置->重置位置和隱私),則可以解決此問題(只要您還確保在完成操作showsUserLocation設置為NO,即可) 。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM