ios - Cannot push a new view when clicking on annotation view -
in iphone app, have controller view , mkmapview.
display several annotation on map, when click on annotation view "calloutaccessorycontroltapped" triggered i'm not able push new view.
self.navigationview null... best way ? need create navigation controller on top of mkmapview ?
-(void)mapview:(mkmapview *)mapview annotationview:(mkannotationview *)view calloutaccessorycontroltapped:(uicontrol *)control { nslog(@"annotation clicked"); // => ok if ([control iskindofclass:[uibutton class]]) { nslog(@"annotation clicked 2"); // => ok // annotation stuff needs passed new view myannotation *annotation = (myannotation*)view.annotation; controlviewcontroller *controlviewcontroller = [[controlviewcontroller alloc] initwithnibname:@"controlviewcontroller" bundle:nil]; controlviewcontroller.thing = annotation.thing; nslog(@"self.navigationcontroller:%@", self.navigationcontroller); // => null // [self.navigationcontroller pushviewcontroller:controlviewcontroller animated:yes]; [controlviewcontroller release]; } }
yep, view controller needs inside uinavigationcontroller. check docs learn how it.
Comments
Post a Comment