viewForHeaderInSection:を使用してUINavigationTabBarにタイマーを追加しようとしました。しかし、それは時間を表示しません。 -(void)viewDidLoad メソッドで同じことを試してみると、動作しています。NavigationTabBar で NSDateFormatter を呼び出すことが可能かどうか、私のコードで何が間違っていますか? ここにコードがあります
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 30)];
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 60, 30)];
label1.backgroundColor=[UIColor blueColor];
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"hh:mm:ss"];
label1.text=[dateFormatter stringFromDate:[NSDate date]];
[self performSelector:@selector(timeLimiteAlert) withObject:self afterDelay:1.0];
[view addSubview:label1];
[label1 release];
return [view autorelease];
}