0

I am very new to iOS development.

My app is a drawing app where you can have multiple pages, and these pages accessed with a drag forwards or backwards -- like iBooks.

The 'Draw View' only accepts input from Apple Pencil, but I can't figure out how to get the view controller to change the page only if the input is a finger. I tried using touchesBegan on the view controller and getting touch.type but this didn't work; it seems only the view receives the touches -- not the view controller. This is a huge problem because it means I can't draw with the pencil -- I can only change the page.

TLDR: how do I get my view controller to not change page when Apple Pencil is the input source?

EDIT: this is not a duplicate question. I already know how to differentiate between a touch of a finger and a touch of the pencil (using touch.type) as I said in the question. however, only the view is receiving touches when I touch the screen, not the view controller. So how do i tell the view controller the type of the touch the view is receiving.

  • Can't you check for Touch type and based on that if touch type is finger, then only change page ? – Surjeet Singh May 24 '17 at 12:47
  • @Surjeet from the post "tried using touchesBegan on the view controller and getting touch.type but this didn't work". maybe I'm doing it wrong? –  May 24 '17 at 12:51
  • Check here https://stackoverflow.com/questions/37133248/how-to-differentiate-whether-a-user-is-tapping-the-screen-with-his-finger-or-an – Surjeet Singh May 24 '17 at 12:53
  • You can detect touch type for apple pencil with if (touch.type == UITouchTypeStylus) { // Do stuff } – Surjeet Singh May 24 '17 at 12:54
  • with all due respect I already know how to do that as I said in my post and in my comment reply to you: ""tried using touchesBegan on the view controller and getting **touch.type**" –  May 24 '17 at 13:05
  • Possible duplicate of [How To Differentiate Whether A User Is Tapping The Screen With His Finger Or An Apple Pencil?](https://stackoverflow.com/questions/37133248/how-to-differentiate-whether-a-user-is-tapping-the-screen-with-his-finger-or-an) – pdilip May 24 '17 at 13:28

0 Answers0