【发布时间】:2016-01-01 14:03:54
【问题描述】:
下面是我的代码。
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];
}
虽然滚动表格视图“如果条件”满足但按钮不隐藏。我想要做的是,如果 API 中的当前日期和日期匹配按钮出现,否则按钮保持隐藏。
【问题讨论】: