gpt4 book ai didi

ios - 操作错误 :@selector in app

转载 作者:行者123 更新时间:2023-11-28 22:35:41 25 4
gpt4 key购买 nike

我正在创建一个应用程序,用户应该能够报告帖子。当用户按下报告按钮时,我想要一个操作表。这是我的代码:

[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];
}

但是当我现在尝试按下报告按钮时,没有任何反应。有人可以帮我解决这个问题吗?

最佳答案

你能试试这个吗:

[actionSheet showInView:self.view];

关于ios - 操作错误 :@selector in app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16123696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com