button 按钮 多次点击仅第一次有效

 

按钮点击方法

- (IBAction)carBrandSeriesButtonClick:(UIButton *)sender {
    
//    [self performSelector:@selector(carModel) withObject:nil afterDelay:2];
    self.carBrandSeriesButton.userInteractionEnabled = NO;//禁用按钮
    if (self.carModelList.count > 0)
    {
        
        HaimaCarModelViewController *carModelvc = [[HaimaCarModelViewController alloc] init];
        carModelvc.carInfoVC = self;
        carModelvc.fromType = HaimaCarComeFromType_Homepage;
        [self.navigationController pushViewController:carModelvc animated:YES];
    }
    else
    {
        
        [self.indicator startAnimating];
        HaimaServerAppointment *server = [HaimaServerAppointment shareServer];
        [server chooseCarBrandCompletion:^(BOOL isSuccess, NSArray *carBrandList) {
            if (isSuccess) {
                [self processCarModelList:carBrandList];
                HaimaCarModelViewController *carModelvc = [[HaimaCarModelViewController alloc] init];
                carModelvc.carInfoVC = self;
                carModelvc.fromType = HaimaCarComeFromType_Homepage;
                [self.navigationController pushViewController:carModelvc animated:YES];
            }
            [self.indicator stopAnimating];
        }];
    }

//请求数据成功后   延时1s  按钮可点击方法
    [self performSelector:@selector(buttonEnableYes) withObject:nil afterDelay:1.0];

}
- (void)buttonEnableYes
{
    self.carBrandSeriesButton.userInteractionEnabled = YES;
}

posted @ 2016-04-19 13:58  instantlife  阅读(498)  评论(0)    收藏  举报