Question

i want to design my interface like this: on top of a screen user can see a picture (image view), in bottom might be a view with buttons (or other control elements). When screen load first i want to show an image and 60% of view that contains buttons, then, user pull bottom view up with gesture, and therefore it hide image view, revealing view full size. Then user can hide it again to 60% of "true" size with pulling bottom with fingers.

Here i tried to post a screen that can explain it visually (because I'm afraid you might not understand what i want to).

I want to know how to implement it, any advice would be appreciated, thanks.

enter image description here

Was it helpful?

Solution

Add swipe gesture to your bottom view as shown below.

UISwipeGestureRecognizer *ges =[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)];
[bottomView addGestureRecognizer:ges];

-- swipe handler --

-(void)swipe:(UISwipeGestureRecognizer *)swipeGes{
    if(swipeGes.direction == UISwipeGestureRecognizerDirectionUp){
        [UIView animateWithDuration:.5 animations:^{
            //set frame of bottom view to top of screen (show 100%)
            bottomView.frame =CGRectMake(0, 0, 320, bottomView.frame.size.height);
        }];
    }
    else if (swipeGes.direction == UISwipeGestureRecognizerDirectionDown){
        [UIView animateWithDuration:.5 animations:^{
            //set frame of bottom view to bottom of screen (show 60%)
            bottomView.frame =CGRectMake(0, 300, 320, bottomView.frame.size.height);
        }];
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top