【发布时间】:2015-03-22 08:25:04
【问题描述】:
我在每个部分的标题中都有一个 UIView 作为子视图。该视图包含开始按钮和带有倒数计时器的标签。 因此,当计时器启动并且 Tableview 滚动时,某些部分会变得隐藏而不是再次显示,它会重新创建我的视图并重置计时器。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
NSString *arrowName = [arrows objectAtIndex:section];
Workouts *workout = [workoutsArray objectAtIndex:section];
UIView* header;
if (section == 0) {
header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 76)];
} else header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 68)];
header.backgroundColor = [UIColor colorWithRed:0.133f green:0.125f blue:0.247f alpha:1.00f];
//The View with Timer Label
TodayWorkoutView* headerView = [[TodayWorkoutView alloc] initWithFrame:CGRectMake(16, header.frame.size.height-60, header.frame.size.width-32, 60)];
headerView.workout = workout;
[header addSubview:headerView];
return header;
}
如何在每个部分中制作计时器,以便在 TableView 滚动时起作用?
【问题讨论】:
标签: uitableview nstimer