I had thought about this too, but was afraid that -drawRect: would be called
more often than the actual content of the view was being changed.
If you could limit the calls within -drawRect: perhaps by setting a content did
change flag in the subclass this might reduce the notifications to be
meaningful.
Like: (written in mail)
-drawRect:(NSRect)rect
{
if ( contentDidChange )
// post notification
[super drawRect:rect];
}
Sandor Szatmari
On Apr 22, 2013, at 13:30, Jens Alfke <[email protected]> wrote:
>
> On Apr 22, 2013, at 12:26 AM, Motti Shneor <[email protected]> wrote:
>
>> I already succeeded in capturing the contents of the view as an image-buffer
>> (out of the CALAyer's context) and I can (brutally) solve my problem by
>> setting up a timer that will sample the view's contents N times a second.
>> However, I'd like to avoid transmitting anything when the view doesn't change
>
> A quick & naive idea is to subclass UIWebView and override -drawRect: to call
> the inherited method and then set a timer that will capture the view's pixels
> a fraction of a second later. (You'd want a timer for coalescing purposes,
> since there are likely to be multiple calls in a short time interval.)
>
> The reason I say this is naive is because UIWebView almost certainly has a
> whole tree of views inside it that do the actual drawing, so the actual
> -drawRect: calls are probably going to those instead. But you could give this
> a try and see if you get anything useful.
>
> —Jens
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]