1

Using CoreGraphics, I am able to get click location.

My requirement is to open different UIViewController base on clicks on different areas of an image.

1 Answer 1

1

You need to create a new UIViewController base on location of your touch using one of the following:

  1. Create it manually

    let controller = SubclassViewController()
    //prepare your view controller here
    
  2. Instantiate controller from storyboard

    if let controller = storyboard.instantiateViewControllerWithIdentifier("identifier") as? SubclassViewController {
        //prepare your view controller here
    }
    
  3. Perform segue to new view controller

    performSegueWithIdentifier("segueIdentifier")
    

    Then prepare your view controller within prepareForSegue:

    if let controller = segue.destinationViewController as? SubclassViewController {
        //prepare your controller here
    }
    

Depending on what your app is doing, you can either to push your new view controller or present it manually

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.