Home Ask Login Register

Developers Planet

Your answer is one click away!

Rakesh kumar February 2016

How to make swipe back in left side in single view

I made more than one view without taking new Controller class , I used UIgestureRecognizer but it not look better.

I want to swipe same like ios device, when we start to swipe from left side corner.


RavikanthM February 2016

You can implement this with scrollview.


1)First place a scrollview that fills the full screen.

2)Next create a container view which is as big as to hold your two views.

    let containerSize = CGSize(width: 640.0, height: 640.0)
    containerView = UIView(frame: CGRect(origin: CGPoint(x: 0, y: 0),size:containerSize))

3) Now you create your view 1 , view2 and add them to container view.

4) Set the scrollview content size to container size

scrollView.contentSize = containerSize;

5) Then set the scrollview delegate method

    func viewForZoomingInScrollView(scrollView: UIScrollView!) -> UIView!{
      return containerView 

Post Status

Asked in February 2016
Viewed 1,947 times
Voted 11
Answered 1 times


Leave an answer

Quote of the day: live life