如何禁用alertview的firstOtherbutton

时间:2014-03-12 11:20:20

标签: ios ios7 uialertview

我有一个以tableview作为子视图的alert-view。我想在tableview firstOtherbutton之后停用didSelectRowAtIndexPath。我可以致电alertViewShouldEnableFirstOtherButton,但firstotherbutton不会改变。

- (void)viewDidLoad
{
    self.announcement=[[UIAlertView alloc] initWithTitle:@"Announcement" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"Tamam", nil];

    [announcement setValue:self.tbl.view forKey:@"accessoryView"];
    announcement.delegate =self;
    announcement.tag=100;

    [announcement show];

    [self.tbl.tableView reloadData];

}
-(void)didSelectAnswer
{
   [self performSelector:@selector(alertViewShouldEnableFirstOtherButton:) withObject:announcement afterDelay:0.001];
}

- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
{
    if (alertView.tag==100)
    {
        if(!self.tbl.deger)
        {
            return YES;
        }
        return NO;
    }
    return NO;
}

1 个答案:

答案 0 :(得分:0)

您必须编写自定义警报视图才能实现此功能。

以下是针对iOS的alertview的一些开源实现: https://www.cocoacontrols.com/tags/uialertview