我不得不按钮添加报警为了这个,我想对按钮的动作做洙我已经writen这个代码来打开警报
cell.btnCommentOption.tag = indexPath.row;
if([Boomerang sharedManager].currentUser.user_id != comment.user.user_id){
cell.btnCommentOption.hidden = YES;
[cell.btnCommentOption addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
}
和按钮动作是
- (IBAction)btnCommentOptionsTapped:(UIButton*)sender {
UIAlertController * alert = [UIAlertController
alertControllerWithTitle:@"Share"
message:@""
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* sharefeed = [UIAlertAction
actionWithTitle:@"Share feed"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:^{}];
}];
UIAlertAction* report = [UIAlertAction
actionWithTitle:@"Report"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:^{}];
}];
UIAlertAction* cancel = [UIAlertAction
actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:^{}];
}];
[alert addAction:sharefeed];
[alert addAction:report];
[alert addAction:cancel];
[self presentViewController:alert animated:YES completion:nil]
}
我有错误,当我添加动作按钮好心帮助我的错误是No invisible @interface for UIImageView declears the selectors addTarget:action:forcontrolEvents
什么错误 –
这是正确的'cell.btnCommentOption.hidden = YES;'或这一个是正确的'cell.btnCommentOption。隐藏= NO;'如果你在打电话恳请更新条件 –
里面有一个看起来 –