1
以下是我的代码。UITableView奇怪行为,滚动
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellTwo" forIndexPath:indexPath];
UILabel * name = (UILabel *)[cell viewWithTag:4];
UILabel * age = (UILabel *)[cell viewWithTag:5];
UILabel * city = (UILabel *)[cell viewWithTag:6];
NSString * currentDate = self.calenderDates[indexPath.section];
NSArray * dicDate = [self.dataDictionay valueForKey:currentDate];
UIButton * checkinBtn = (UIButton*)[cell viewWithTag:9];
UIButton * checkoutBtn = (UIButton*)[cell viewWithTag:10];
checkinBtn.tag = indexPath.row;
checkoutBtn.tag = indexPath.row;
NSString * papikDate = [dicDate[indexPath.row] valueForKey:@"strat_date"];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd"];
NSString * todayDate = [dateFormat stringFromDate:[NSDate date]];
if ([papikDate isEqualToString:todayDate]) {
[checkinBtn setHidden:NO];
[checkinBtn setHidden:NO];
} else {
[checkinBtn setHidden:YES];
[checkinBtn setHidden:YES];
}
虽然滚动tableview“如果条件”确实满足,但按钮不隐藏。我想要做的是,如果当前日期和日期在API匹配按钮出现其他按钮仍然隐藏。