Robię przycisków niestandardowych bar dla UINavigationBar używam następujący kodUIBarButtonItem widok niestandardowy w UINavigationBar
UIImageView *backImgView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"chk_back.png"]]; [backImgView setUserInteractionEnabled:YES];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:backImgView];
[backButton setTarget:self];
[backButton setAction:@selector(BackBtn)];
checkIn_NavBar.topItem.leftBarButtonItem = backButton;
Problem polega na tym, że nie dzwoni jego działanie. Co robię źle?
Czy mogę zobaczyć na twojej metodzie BackBtn? – Arthur
Co to jest checkIn_NavBar? Czy masz silne odniesienie do niego? Dlaczego nie używać self.navigationItem.leftBarButtonItem? –
spróbuj i użyj [checkIn_NavBar setLeftBarButtonItem: backButton]; lub self.navigationItem.leftBarButtonItem = backButton; – Bonnie