UIKit Drawing Tutorial Fix

I tried the tutorial from raywenderlich.com but the behavior was incorrect. The canvas or UIImageView seems to move after lifting my finger.

It tried to run the official project from raywenderlich.com but it has the same strange behavior.

Luckily I found a solution, you need to change this line inside touchesEnded function

// from
UIGraphicsBeginImageContext(mainImageView.frame.size)
// change to 
UIGraphicsBeginImageContext(view.frame.size)

And that’s it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

  You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

  You are commenting using your Twitter account. Log Out /  Change )

  You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s