Так вот что у меня есть. Я создал кнопку и установил ее в действие, но каждый раз, когда я нажимаю кнопку, она вырывает программу. Почему не работает моя кнопка? Заранее спасибо.Программно добавленная кнопка не работает
UIButton *currentGamesButton = [UIButton buttonWithType:UIButtonTypeCustom];
currentGamesButton.frame = CGRectMake(124,18,72,65);
[currentGamesButton addTarget:self
action:@selector(goToCurrentGamesViewController:)
forControlEvents:UIControlEventTouchDown];
UIImage *currentGamesPNG = [UIImage imageNamed:@"CurrentGamesHighlightedState.png"];
[currentGamesButton setBackgroundImage:currentGamesPNG forState:UIControlStateNormal];
[self.view addSubview:currentGamesButton];
Я подозреваю, что он не находит селектор goToCurrentGamesViewController: можете ли вы показать код для этот метод, включая его объявление? –
в .h: (IBAction) goToCurrentGamesViewController; – nfoggia
в .m (IBAction) goToCurrentGamesViewController { – nfoggia