UIToolbar向上滑动,UIView在显示的视图中向下滑动

时间:2012-02-07 17:27:51

标签: iphone

UIToolbar Mainviewcontroller上的UIView显示UIToolbar时,ViewView在显示的infobutton中向上滑动。从UIToolbar按下Modalviewcontroller到现在的modalviewcontroller,在解雇时,modalviewcontroller向下滑动。

MainviewcontrollerUIToolbar两者在Modalviewcontroller中表现正常,即- (void)displayviewsAction:(id)sender { self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease]; [self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; PageOneViewController *viewController = [[[PageOneViewController alloc] init]autorelease]; [self.view addSubview:viewController.view]; [self.view addSubview:self.toolbar]; } 没有向上滑动,{{1}}在解雇时不会滑落。

{{1}}

任何想法为什么会发生,我该怎么做才能解决它。

1 个答案:

答案 0 :(得分:0)

解决了这两个问题中的一个问题

添加此声明

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

删除了解雇modalviewcontroller时显示的差距

现在基本上displayviewsAction就像这样

- (void)displayviewsAction:(id)sender
{
   self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];

    [self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

   PageOneViewController *viewController = [[[PageOneViewController alloc] init]autorelease];

   [self.view addSubview:viewController.view];

    [self.navigationController setToolbarHidden:NO];

   [self.view addSubview:toolbar];       
}

但是在加载视图时仍然会从底部与uitoolbar差距挣扎。任何想法如何从视图底部解决UIToolbar差距。