0
我已經添加了tabbarcontroller,setViewControllers用於提供uiviewcontroller數組。 viewDidLoad被調用這個viewContollers,但不是viewDidAppear既不viewWillAppear。 代碼我已經寫viewDidAppear not called
- (void)loadView {
printf("*********\n loadView \n********* ");
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor whiteColor];
self.view = contentView;
[contentView release];
UITabBarController *tabbar = [[UITabBarController alloc] init];
tabbar.view.frame = CGRectMake(0, 0, 320, 460);
piechartViewController *pr=[[piechartViewController alloc]init];
pr.tagInAction=1;
[email protected]"Type";
pr.tabBarItem.image=[UIImage imageNamed:@"trend.png"];
pr.sDate=sDate;
pr.nDate=nDate;
piechartViewController *pr1=[[piechartViewController alloc]init];
[email protected]"category";
pr1.tagInAction=4;
pr1.sDate=sDate;
pr1.nDate=nDate;
piechartViewController *pr2=[[piechartViewController alloc]init];
[email protected]"paidWith";
pr2.tagInAction=3;
pr2.sDate=sDate;
pr2.nDate=nDate;
[tabbar setViewControllers:[NSArray arrayWithObjects:pr,pr1,pr2,nil]];
[self.view addSubview:tabbar.view ];
[pr release];
[pr1 release];
[pr2 release];
}