3
我有一個TabView,並且我的其中一個選項卡包含一個mapView。當我因爲某種原因加載了帶有mapView的選項卡時,會調用兩次regionDidChangeAnimated。我已經在其他功能中加入了斷點,並且禁止它們全部運行,所以它實際上只是拉起了一張空白的地圖。儘管如此,regionDidChangeAnimated被調用兩次。任何想法,爲什麼這可能是?mkMapView的regionDidChangeAnimated委託觸發了兩次標籤加載
下面的代碼:
SecondViewController.h:
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface SecondViewController : UIViewController<MKMapViewDelegate>
{IBOutlet MKMapView *mapView;}
@end
SecondViewController.m
#import "SecondViewController.h"
@implementation SecondViewController
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
//[self showTowers];
NSLog(@"regionDidChangeAnimated");
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
return self;
}
- (void)dealloc {
[super dealloc];
}
你是否改變了地圖的中心或設置了地圖的區域? – visakh7 2011-02-25 06:35:12
不需要,我會用代碼更新我的問題。 – Sina 2011-02-25 06:48:10