In viewDidLoad
, you are declaring local variables textView
, scrollObject
, and pan
.
The properties declared in the header file are never set so they are nil
when the gesture recognizer method is called and "nothing happens" when you call methods on nil
.
In viewDidLoad, UITextView *textView = ...
is declaring a local variable that has no connection to the property you declared in the header.
Instead, do @synthesize
, and in viewDidLoad
, set the property instead:
self.textView = ...
Do the same for scrollObject
.
By the way, you don't need to declare pan
as a property or ivar and I would remove it (leave it as a local variable in viewDidLoad)
.