现在的位置: 首页 > 综合 > 正文

隐藏navigation 及 uitabbar

2013年04月03日 ⁄ 综合 ⁄ 共 2477字 ⁄ 字号 评论关闭

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];

}

隐藏tabbar可以这样:

- (void) hideTabBar:(BOOL) hidden {

    

    [UIView
beginAnimations:nil
context:NULL];

    [UIView
setAnimationDuration:0.7];

    

    for(UIView *view
in self.tabBarController.view.subviews)

    {

        if([view isKindOfClass:[UITabBar
class]])

        {

            if (hidden) {

                [view setFrame:CGRectMake(view.frame.origin.x,
480, view.frame.size.width, view.frame.size.height)];

            } else {

                [view setFrame:CGRectMake(view.frame.origin.x,
480-49, view.frame.size.width, view.frame.size.height)];

            }

        }

        else

        {

            if (hidden) {

                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y,
view.frame.size.width,
480)];

            } else {

                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y,
view.frame.size.width,
480-49)];

            }

        }

    }

    

    [UIView
commitAnimations];

}

响应手势:

http://blog.csdn.net/shijiucdy/article/details/7364143

-(void)viewDidLoad{

UISwipeGestureRecognizer *recognizer; 

recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

     [recognizer setDirection :( UISwipeGestureRecognizerDirectionRight)];

    [[self viewaddGestureRecognizer:recognizer];

[recognizer release];

    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

     [recognizer setDirection :( UISwipeGestureRecognizerDirectionLeft)];

    [[self viewaddGestureRecognizer:recognizer];

[recognizer release];

 recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

     [recognizer setDirection :( UISwipeGestureRecognizerDirectionUp)];

    [[self viewaddGestureRecognizer:recognizer];

[recognizer release];

 

 UISwipeGestureRecognizer *recognizer;

    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

     [recognizer setDirection :( UISwipeGestureRecognizerDirectionDown)];

    [[self viewaddGestureRecognizer:recognizer];

[recognizer release];


}

-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer{

if(recognizer.direction==UISwipeGestureRecognizerDirectionDown)
{

       NSLog(@"swipe down");

//执行程序

}

if(recognizer.direction==UISwipeGestureRecognizerDirectionUp) {

       NSLog(@"swipe up");

//执行程序

}


if(recognizer.direction==UISwipeGestureRecognizerDirectionLeft)
{

       NSLog(@"swipe left");

//执行程序

}


if(recognizer.direction==UISwipeGestureRecognizerDirectionRight)
{

       NSLog(@"swipe right");

//执行程序

}


}

抱歉!评论已关闭.