steipete / PSPDFTextView

A subclass of UITextView that fixes the most glaring problems from iOS 7 and 7.1.
http://pspdfkit.com
MIT License
873 stars 73 forks source link

Fixed bug that caused some UIScrollView delegate method to not fire #3

Closed Ciechan closed 10 years ago

Ciechan commented 10 years ago

Presumably for performance reasons UIScrollView has some flags that mark whether its delegate implements some of the UIScrollViewDelegate methods:

...
unsigned int delegateScrollViewDidScroll : 1; 
unsigned int delegateScrollViewDidZoom : 1; 
unsigned int delegateContentSizeForZoomScale : 1; 

The respondsToSelector: check occurs when the delegate is set, and only if the delegate is different than the already stored. Since the code keeps setting the same delegate, the UIScrollView won't recheck the realDelegate for implementations. I fixed the issue by nilling out the delegate, as we as reordering the realDelegate setter, to make sure the UIScrollView queries the correct object.

steipete commented 10 years ago

Ah - makes sense - thanks!