Re: UIImageView drawRect not called
Re: UIImageView drawRect not called
- Subject: Re: UIImageView drawRect not called
- From: Julian <email@hidden>
- Date: Sun, 4 Jan 2009 00:59:31 -0800
I have independently encountered the same scenario and gotten the same
results. The documentation suggests that if you call setNeedsDisplayInRect:,
drawRect: will get called. Also, I have put a symbolic breakpoint on
-[UIImageView drawRect:], and it does get called sometimes, but seemingly
not every time a new image view is created...
On Tue, Dec 2, 2008 at 8:02 AM, David Duncan <email@hidden> wrote:
> On Dec 1, 2008, at 6:45 PM, DKJ wrote:
>
> I have a subclass of UIImageView, MySubView, which is instantiated and
>> added as a subview in the viewDidLoad method of a UIViewController.
>> MySubView displays a picture without difficulty when its image property is
>> set in its initWithFrame method. But its drawRect method is never called. (I
>> put an NSLog call inside it to check.) I've tried sending MySubView
>> setNeedsDisplay messages from all kinds of places, to no avail.
>>
>> I suspect I'm missing something very simple. Any advice would be
>> appreciated.
>>
>
>
> There are 2 ways to get content into a layer without subclassing. The first
> is the delegate method, which in UIKit eventually leads to a -drawRect:
> call. The other is to set the contents of the layer. Since your not getting
> a -drawRect: call, I would suspect that the UIImageView sets the contents of
> its layer rather than calling -drawRect: (which would make sense since it
> would be better performance than using the -drawRect: method).
>
> Could you explain what you are trying to do? There may be a better solution
> than "implement your own UIView subclass" here, but without more information
> its hard to know...
> --
> David Duncan
> Apple DTS Animation and Printing
>
>
> _______________________________________________
>
> 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
>
_______________________________________________
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