내 앱이 시작될 때 시작 화면을로드 중입니다. 그런 다음 TabBarController 및 ViewControllers를로드하려고합니다. 그러나 내 TabBarController 창이 화면 크기에 맞게 조정되지 않습니다.보기의 하위보기로 TabBarController 추가
아마도 하단의 TabBar 중 3/4이 잘 리기 시작하고 상태 표시 줄 아래의 화면 상단에 슬림 한 aprox 20 픽셀 갭이 있습니다. TabBarController의 크기를 올바르게 조정하려면 어떻게해야합니까? 나는 마지막으로 작동가 someting을 발견
-(void)loadView{
// Init the view
CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
UIView *view = [[UIView alloc] initWithFrame:appFrame];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
self.view = view;
[view release];
splashImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Splash.png"]];
splashImageView.frame = CGRectMake(0,0,320,458);
[self.view addSubview:splashImageView];
viewController = [[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bundle:[NSBundle mainBundle]];
//viewController.view.bounds = [[UIScreen mainScreen]bounds];
viewController.title = @"Quiz";
viewController.tabBarItem.image = [UIImage imageNamed:@"puzzle.png"];
UIViewController *viewController2 = [[UIViewController alloc] initWithNibName:nil bundle:nil];
viewController2.title = @"Nada";
viewController2.tabBarItem.image = [UIImage imageNamed:@"magnifying-glass.png"];
//viewController.view.alpha = 0.0;
//[self.view addSubview:viewController.view];
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:viewController, viewController2, nil];
[viewController2 release];
tabBarController.view.alpha = 0.0;
//tabBarController.tabBarItem.image = [UIImage imageNamed:@"State_California.png"];
//tabBarController.tabBarItem.title = @"State_California.png";
tabBarController.view.bounds = [[self view] bounds];
//tabBarController.view.frame = [[UIScreen mainScreen] applicationFrame];
[self.view addSubview:tabBarController.view];
timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(fadeScreen) userInfo:nil repeats:NO];
}
-(void) fadeScreen
{
[UIView beginAnimations:nil context:nil]; // begin animation block
[UIView setAnimationDuration:0.75]; // sets animation duration
[UIView setAnimationDelegate:self]; // sets the delegate for this block
[UIView setAnimationDidStopSelector:@selector(finishedFading)]; // Calls finishFading
self.view.alpha = 0.0; // // Fades the alpha to 0 over animation
[UIView commitAnimations]; // Commits this block, done
}
-(void) finishedFading
{
[UIView beginAnimations:nil context:nil]; // Begin animation block
[UIView setAnimationDuration:0.75]; // set duration
self.view.alpha = 1.0; // fades the view to 1.0 alpha over .75 seconds
//viewController.view.alpha = 1.0;
tabBarController.view.alpha = 1.0;
[UIView commitAnimations];
[splashImageView removeFromSuperview];
}
viewWillAppear에서 self.tabBarController.view.frame = [[self view] frame]을 실행하면 해당 지점에서 경계 및 프레임이 올바르게 계산 되었기 때문에 숫자를 직접 계산하지 않아도 작동합니다. – pulkitsinghal
이 더 나은 답변 : tabBarController.view.frame = CGRectMake (0, 0, self.view.frame.size.width, self.view.frame.size.height); 너비와 높이가 사용자가 사용하는 각 장치에 따라 다르기 때문에? – lakesh