0
- (void)viewWillAppear:(BOOL)animated
{
MKUserTrackingBarButtonItem *trackingBarButtonItem = [[MKUserTrackingBarButtonItem alloc]initWithMapView:_mapView];
NSArray *barButtonItems = [NSArray arrayWithObjects:trackingBarButtonItem, nil];
mapToolbar.items = barButtonItems;
...
}
代碼工作在iPhone上正常,但在iPad上,當視圖卸載我得到一個錯誤:無法刪除觀察員<MKUserTrackingBarButtonItem
Cannot remove an observer <MKUserTrackingBarButtonItem 0x9cc0930> for the key path
"controlSize" from <UIButton 0x991b420> because it is not registered as an observer.'
我測試和按鈕在iOS 5.1中工作正常 – Shmidt 2012-03-08 16:48:50