Wednesday, 15 October 2014

Slider Menu



    
    
    UISwipeGestureRecognizer *oneFingerSwipeLeft = [[UISwipeGestureRecognizer alloc]
                                                    initWithTarget:self
                                                    action:@selector(swipeLeft)] ;
    [oneFingerSwipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
    [[self view] addGestureRecognizer:oneFingerSwipeLeft];
    
    UISwipeGestureRecognizer *oneFingerSwipeRight = [[UISwipeGestureRecognizer alloc]
                                                     initWithTarget:self
                                                     action:@selector(swipeRight)];
    [oneFingerSwipeRight setDirection:UISwipeGestureRecognizerDirectionRight];
    [[self view] addGestureRecognizer:oneFingerSwipeRight];



-(void)swipeRight
{
    NSLog(@"RIGHT");
    if ([appdelegate.language isEqualToString:@"1"])
    {
    if(status==NO)
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.4];
        //        self.navigationController.navigationBarHidden=NO;
        if([[UIScreen mainScreen]bounds].size.height==480)
        {
            frontview.frame = CGRectMake(280, 0, 320, 480);
            self.navigationController.navigationBarHidden=YES;
        }
        else
        {
            frontview.frame = CGRectMake(280, 0, 320, 568);
            self.navigationController.navigationBarHidden=YES;
        }
        
        status = YES;
    }
    [UIView setAnimationDuration:0.0];
    }
    else
    {
        if(status==YES)
        {
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.4];
            //        self.navigationController.navigationBarHidden=NO;
            if([[UIScreen mainScreen]bounds].size.height==480)
            {
                frontview.frame = CGRectMake(0, 0, 320, 480);
                self.navigationController.navigationBarHidden=YES;
            }
            else
            {
                frontview.frame = CGRectMake(0, 0, 320, 568);
                self.navigationController.navigationBarHidden=YES;
            }
            
            status = NO;
        }
        [UIView setAnimationDuration:0.0];
    }
}

-(void)swipeLeft
{
    NSLog(@"LEFT");
    if ([appdelegate.language isEqualToString:@"1"])
    {
        
            
    if(status == YES)
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.4];
        if([[UIScreen mainScreen]bounds].size.height==480)
        {
            frontview.frame = CGRectMake(0, 0, 320, 480);
            self.navigationController.navigationBarHidden=YES;
        }
        else
        {
            frontview.frame = CGRectMake(0, 0, 320, 568);
            self.navigationController.navigationBarHidden=YES;
        }
        //        UIRefreshControl *refreshControl = [[UIRefreshControl alloc]  init];
        //        refreshControl.tintColor = [UIColor redColor];
        //        [bottomView addSubview:refreshControl];
        //        self.navigationController.navigationBarHidden=YES;
        status = NO;
    }
    [UIView setAnimationDuration:0.0];
    }
    else
    {
        if(status == NO)
        {
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.4];
            if([[UIScreen mainScreen]bounds].size.height==480)
            {
                frontview.frame = CGRectMake(-280, 0, 320, 480);
                self.navigationController.navigationBarHidden=YES;
            }
            else
            {
                frontview.frame = CGRectMake(-280, 0, 320, 568);
                self.navigationController.navigationBarHidden=YES;
            }
            //        UIRefreshControl *refreshControl = [[UIRefreshControl alloc]  init];
            //        refreshControl.tintColor = [UIColor redColor];
            //        [bottomView addSubview:refreshControl];
            //        self.navigationController.navigationBarHidden=YES;
            status = YES;
        }
        [UIView setAnimationDuration:0.0];
    }
}
- (void)ShowHide
{
    if ([appdelegate.language isEqualToString:@"1"])
    {
        if(status == NO)
        {
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.4];
            if([[UIScreen mainScreen]bounds].size.height==480)
            {
                frontview.frame = CGRectMake(280, 0, 320, 480);
                self.navigationController.navigationBarHidden=YES;
            }
            else
            {
                frontview.frame = CGRectMake(280, 0, 320, 568);
                self.navigationController.navigationBarHidden=YES;
            }
            //        UIRefreshControl *refreshControl = [[UIRefreshControl alloc]  init];
            //        refreshControl.tintColor = [UIColor redColor];
            //        [bottomView addSubview:refreshControl];
            //        self.navigationController.navigationBarHidden=YES;
            status = YES;
        }
        else
        {
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.4];
            //        self.navigationController.navigationBarHidden=NO;
            if([[UIScreen mainScreen]bounds].size.height==480)
            {
                frontview.frame = CGRectMake(0, 0, 320, 480);
                self.navigationController.navigationBarHidden=YES;
            }
            else
            {
                frontview.frame = CGRectMake(0, 0, 320, 568);
                self.navigationController.navigationBarHidden=YES;
            }
            status = NO;
        }
        [UIView setAnimationDuration:0.0];
    }
    else
    {
        if(status == NO)
        {
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.4];
            if([[UIScreen mainScreen]bounds].size.height==480)
            {
                frontview.frame = CGRectMake(-280, 0, 320, 480);
                self.navigationController.navigationBarHidden=YES;
            }
            else
            {
                frontview.frame = CGRectMake(-280, 0, 320, 568);
                self.navigationController.navigationBarHidden=YES;
            }
            //        UIRefreshControl *refreshControl = [[UIRefreshControl alloc]  init];
            //        refreshControl.tintColor = [UIColor redColor];
            //        [bottomView addSubview:refreshControl];
            //        self.navigationController.navigationBarHidden=YES;
            status = YES;
        }
        else
        {
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:0.4];
            //        self.navigationController.navigationBarHidden=NO;
            if([[UIScreen mainScreen]bounds].size.height==480)
            {
                frontview.frame = CGRectMake(0, 0, 320, 480);
                self.navigationController.navigationBarHidden=YES;
            }
            else
            {
                frontview.frame = CGRectMake(0, 0, 320, 568);
                self.navigationController.navigationBarHidden=YES;
            }
            status = NO;
        }
        [UIView setAnimationDuration:0.0];
   
    }

}

No comments:

Post a Comment