Reputation: 1656
In MKAnnotation
there are just title and subtitle, and i don't add anything control to annotation. How to I add a button?
Upvotes: 0
Views: 7679
Reputation: 8357
Edit: Disregard this answer. Your complete question was not being shown because of bad markup and I extrapolated (incorrectly) what your question was.
You can drag anything onto the UITableViewCell
you want to from the objects palette at right.
If you want to add it as the accessoryView
however, do not do that.
Add it to the interface file as a separate top level object and drag a connection from the accessoryView
outlet of the cell to the view/button you want.
Upvotes: -1
Reputation: 3637
Try using following delegate method of Map View. You can set right call out accessory view as button
- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation{
MKAnnotationView *view = nil;
//MKPinAnnotationView *view=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"HotSpotsLoc"];
if(annotation !=mapView.userLocation){
view = (MKAnnotationView *)
[mapView dequeueReusableAnnotationViewWithIdentifier:@"identifier"];
if(nil == view) {
view = [[[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"identifier"]
autorelease];
}
ParkPlaceMark *currPlaceMark = annotation;
NSLog(@"%i",currPlaceMark.position);
view.image = [UIImage imageNamed:@"pin.png"];
UIButton *btnViewVenue = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
view.rightCalloutAccessoryView=btnViewVenue;
view.enabled = YES;
view.canShowCallout = YES;
view.multipleTouchEnabled = NO;
//view.animatesDrop = YES;
}
return view;
}
Upvotes: 4