iphone - Selector of one item of UIToolbar doesn't work -
read following code:
// creiamo la toolbar sotto uitoolbar *toolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, 372, 320, 44)]; toolbar.tintcolor = [uicolor blackcolor]; uiimageview *imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"imgimpostazionitoolbar.png"]]; uibarbuttonitem *pulsanteimpostazioni = [[uibarbuttonitem alloc] initwithcustomview:imageview]; [pulsanteimpostazioni settarget:self]; [pulsanteimpostazioni setaction:@selector(prova)]; [imageview release]; uibarbuttonitem *spaziatore = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil]; nsarray *buttons = [[nsarray alloc] initwithobjects:spaziatore, pulsanteimpostazioni, spaziatore, nil]; [toolbar setitems:buttons animated:no]; [self.view addsubview:toolbar]; [buttons release];
i can see correctly image when try touch nothing happen. didn't set correctly selector of "pulsanteimpostazioni"? thanks
p.s. "prova" contain nslog.
try [pulsanteimpostazioni setaction:@selector(prova:)];
the colon @ end of selector name matters.
Comments
Post a Comment