私はObjective Cの初心者ですが、すぐに習得できます。私のプロジェクトは非常に完成しており、デリゲートなどよりもクラスを実装しました。
MKMapView を使用して地図上に表示しています。また、ユーザーがピンをクリックして情報を返す必要がありますが、情報を送信する前に MKViewMap がいくつかの推定を行うことを望んでいます。
そのため、MKMapView をサブクラス化し、このクラスを使用して表示しています。しかし、私は代表者を呼んでいません。標準的な方法で MKViewMap を使用していたときは、正常に機能しました。ここにいくつかのコードがあります。サブクラスにはデリゲート プロトコルがあり、これは完全に機能します
// .h ファイル
#import < MapKit/MapKit.h >
@protocol MyMapViewDelegate < NSObject >
@required
- (void) ReturnAddressToHail:(NSString*) FullAddresse andNumber:(NSString*) FullNumber;
- (void) ReturnSelectedDriverHash:(NSString*) DriverHash;
@end
@interface MyMapViewClass : MKMapView < MKMapViewDelegate >
{
id < MyMapViewDelegate > delegate;
CLLocationCoordinate2D mapCenter;
NSDictionary *Info;
CLLocation * ClientNewLocation;
}
@property (retain) id delegate;
// .m ファイル
#import "MyMapViewClass.h"
#import "NSObject+MapAnnotationHelper.h"
@implementation MyMapViewClass
@synthesize geoCoder;
@synthesize delegate;
self.delegate = self;
-(void) mapView:(MKMapView *) mapView regionDidChangeAnimated:(BOOL)animated
{
(void) self.updateAddress;
NSLog(@"regionchange delegate");
}
後者は決して呼び出されません。何か案は?