viewController没有全屏

时间:2012-12-26 23:26:52

标签: iphone ipad ios5

任何人都知道如何实现像viewController这样的东西没有全屏,就像我们点击iPhone中的搜索一样? 我想要当用户向上滑动时显示viewController(半高)。 没有塞!我希望同时显示旧视图控制器。 提前致谢

3 个答案:

答案 0 :(得分:1)

如果它很简单,我会在底部正下方的UIView添加UIViewController - 然后当您点击“搜索”或其他内容时,在视图中向UIView设置动画用动画块:

- (IBAction)btnTouch:(id)sender
{
        [UIView animateWithDuration:0.3
                              delay:0.0
                            options: UIViewAnimationCurveEaseInOut
                         animations:^{

                              //bring searchView up
                             _searchView.transform = CGAffineTransformMakeTranslation(0, -80);

                         }
                         completion:^(BOOL finished){

                         }

         ];
}

然后,当你完成后,通过使用与该行相同的动画块将视图推回原点:

_searchView.transform = CGAffineTransformMakeTranslation(0, 0);

答案 1 :(得分:1)

我为整个项目添加了这种类型的功能,我在窗口中添加QRView,以便用户从任何项目视图中翻转视图...

请参阅我的代码示例..

只需将UISwipeGestureRecognizer设置为您要呈现的第二个视图,如下所示......

 CATransition *animation = [CATransition animation];
    [animation setDelegate:self];   
    [animation setType:kCATransitionFade];
    [animation setDuration:0.5];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                  kCAMediaTimingFunctionEaseInEaseOut]];
    [[self.view layer] addAnimation:animation forKey:kAnimationKey];
    UISwipeGestureRecognizer *swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(addCustomBottomBar)] autorelease];
    swipeGesture.numberOfTouchesRequired = 1;
    swipeGesture.direction = (UISwipeGestureRecognizerDirectionDown);
    [yourViewController.view addGestureRecognizer:swipeGesture];/// use your view name here, its depends on your requirement
    UISwipeGestureRecognizer *swipeGestureTop = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(addCustomBottomBar)] autorelease];
    swipeGestureTop.numberOfTouchesRequired = 1;
    swipeGestureTop.direction = (UISwipeGestureRecognizerDirectionUp);

    [yourViewController.view addGestureRecognizer:swipeGestureTop];

当您向上滑动视图时调用此波纹管方法...

另外,只需添加一个名为BOOL的{​​{1}}变量,并在isViewPop方法中将其设置为NO

viewDidLoad:

我希望这个答案对你有帮助......

答案 2 :(得分:0)

您可以拥有背景视图控制器[self presentViewController:vc animated:YES completion:nil];并将前视图控制器的帧设置为屏幕的一半。这样,由于前视图的下半部分是透明的,因此您的背景视图控制器仍然可见