我有添加到UIView
的单选按钮,并使用添加到alertview
的视图:
[alertHours setValue:viewHours forKey:@"accessoryView"];
按钮及其
tag
设置,所以现在我想在按钮动作事件中获取所有按钮,我使用此代码来检索所有按钮:for (int i = 111 ; i <= 117 ; i++){
UIButton *btnSender = (UIButton*)[self.view viewWithTag:i];
[btnSender setImage:[UIImage imageNamed:@"Radio"] forState:UIControlStateNormal];
}
但无法使用此按钮,我也使用过:
UIButton *btnSender = (UIButton*)[alertObject viewWithTag:i];
但同样,无法获取按钮。
我如何才能在操作方法中获得所有按钮?
最佳答案
尝试
UIButton *btnSender = (UIButton*)[viewHours viewWithTag:i];
由于按钮位于viewHours视图中。