我不得不按鈕添加報警爲了這個,我想對按鈕的動作做洙我已經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;'如果你在打電話懇請更新條件 –
裏面有一個看起來 –