我正在创建一个应用程序,用户应该能够报告帖子。当用户按下报告按钮时,我想要一个操作表。这是我的代码:
[self.avatarImageView.profileButton addTarget:self action:@selector(didTapReportButtonAction:) forControlEvents:UIControlEventTouchUpInside];
这是 didTapReportButtonAction 代码:
- (void)didTapReportButtonAction:(UIButton *)button {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Destructive" otherButtonTitles:@"Other1", @"Other2", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[actionSheet addButtonWithTitle:@"Add"];
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
}
但是当我现在尝试按下报告按钮时,什么也没有发生。有人可以帮我弄这个吗?