Re: Third time I ask - please help. How to trace visible change in a UIView (UIWebView)
Re: Third time I ask - please help. How to trace visible change in a UIView (UIWebView)
- Subject: Re: Third time I ask - please help. How to trace visible change in a UIView (UIWebView)
- From: Motti Shneor <email@hidden>
- Date: Wed, 24 Apr 2013 07:55:16 +0300
OK!!!! Thanks Marco. Thad did the trick!!!
As I was suspecting, my "Mac" mind was hiding the solution from me. I didn't guess that the UIWebView had its own internal UIScrollView to support all the navigation gestures (scroll, zoom, rotate, translate etc.)
On the Mac, usually a view is usually just a view, and if you want to scroll it, you'd need to embed it into a scroll-view yourself, and manage the interaction.
I tried it now , and it works perfect for my needs. In addition, I get a first delegate call when the content is "loaded" from the UIWebView itself. This signifies for me the first time the document is already rendered, and where I take my first snapshot. I ignore all the scrollView delegate calls prior to this call.
I also limit my snapshots to N times a second (in case I receive too frequent "scrolling" events) and this further optimize my capturing scheme.
I seem to have a loose end though -- when I examine the UIWebView's scrollView property, it initially has a non-nil delegate. I don't know if I should "interpose" as delegate and after taking my snapshot, call the original delegate, or only set myself as a delegate instead of the original.
I'm afraid that "posing" as the delegate but still maintaining the original delegate, may imply that I need to implement the WHOLE delegate protocol, just to pass on all delegate calls to the original delegate.
Any ideas?
Motti Shneor, Mac OS X Software Architect & Team Leader
Spectrum Reflections Ltd.
On 22 באפר 2013, at 16:08, Marco Tabini wrote:
>
> On 2013-04-22, at 9:04 AM, Motti Shneor <email@hidden> wrote:
>
>> To be very precise --- I'd like to know how to be notified about ANY UIView visual change. It somehow seems very obvious to me that such "delegate call" must exist. Maybe I'm overlooking something very basic here.
>
> I think I had completely misunderstood what you wanted to do! I think what you want to do is interpose yourself as the delegate of the UIWebView's UIScrollView instance (accessible through the -scrollview property); that lets you track changes in scroll position, zoom level, etc. Is that what you meant?
>
>
> —Mt.
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden