我正在尝试从地图上的标记中获取事件。这是包含 mapView 的 MainViewController 中的一些代码。
UIImage* labelView = [self snapshotImage:theView];
UIImageView *imageView=[[UIImageView alloc]initWithImage:labelView];
CGRect rect=CGRectMake(0,0,imageView.image.size.width,imageView.image.size.height);
MyRMView *myrm = [[MyRMView alloc]initWithFrame:rect];
UIButton *sens = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[sens addTarget:self
action:@selector(DoSomething:)
forControlEvents:UIControlEventTouchUpInside];
sens.frame = rect;
[myrm addSubview:imageView];
[myrm addSubview:sens];
MyRMMarker* newMarker = [[MyRMMarker alloc] initWithUIImage:nil anchorPoint:CGPointMake(0.0, 1.0)];
newMarker.label = myrm;
MyRMMarker
继承自RMMarker
其继而继承自CALayer
。该label
属性本质上是一个 UIView 。
问题是,我没有从DoSomething
.
任何帮助将不胜感激。
谢谢!