Я создал пользовательский класс представления. Я инициализирую его в классе контроллера вида. Я включил взаимодействие с пользователем, а затем он не работает. Я искал его в похожих вопросах, но большинство из них говорит, чтобы включить взаимодействие с пользователем.
Вот код, который я написал.UITapGestureRecognizer не работает над пользовательским классом UIView
@interface ProfileCreatorViewController(){
SectionTitleView *ProfileTitle;
CGRect mainFrame;
}
@end
@implementation ProfileCreatorViewController
- (void)viewDidLoad {
[super viewDidLoad];
mainFrame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + NAVBAR_HEIGHT, self.view.frame.size.width, self.view.frame.size.height);
CGRect profileFrame = CGRectMake(mainFrame.origin.x + 5, mainFrame.origin.y, mainFrame.size.width - 20, 50);
ProfileTitle = [[SectionTitleView alloc]initWithFrame:profileFrame withTitle:@"Profile" withUnderLineColor:[UIColor blackColor] withDownButton:[UIImage imageNamed:@"rightArrow"]];
[self.view addSubview:ProfileTitle];
UITapGestureRecognizer *recog = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(downButtonClicked)];
[ProfileTitle addGestureRecognizer:recog];
ProfileTitle.userInteractionEnabled = YES;
}
-(void) downButtonClicked{
NSLog(@"clicked");
}
Нет, до сих пор не WOKING. Спасибо хоть. –
'NSLog' youe view проверить, присвоено ли звание тегу или нет – Mukesh