Skip to main content

objective c - When to override updateTrackingAreas -


so have quite big nsscrollview several custom views in it. in these custom views i'm overriding -(void)updatetrackingareas this:

- (void)updatetrackingareas { [self removetrackingarea:trackingarea]; trackingarea = [[nstrackingarea alloc] initwithrect:[self bounds] options:(nstrackingcursorupdate | nstrackingactivewhenfirstresponder | nstrackinginvisiblerect) owner:self userinfo:nil]; [self addtrackingarea:trackingarea]; } 

but somehow feel little unefficient since have 50 instances of custom view in nsscrollview , 5 of them visible @ time , way i'm updating tracking areas of non-visible views.

so thought skip updating tracking areas if view not in nsscrollview's visible rect. like:

- (void)updatetrackingareas { if(!nsintersectsrect([self frame], [[self superview] visiblerect])) { return; } // ... } 

this seems working out i'm not sure if safe.

does have advice on matter?

objective c - when override updatetrackingareas - stack overflow

learn, share, build

each month, on 50 million developers come stack overflow learn, share knowledge, , build careers.

join world’s largest developer community.

sign up

so have quite big nsscrollview several custom views in it. in these custom views i'm overriding -(void)updatetrackingareas this:

- (void)updatetrackingareas { [self removetrackingarea:trackingarea]; trackingarea = [[nstrackingarea alloc] initwithrect:[self bounds] options:(nstrackingcursorupdate | nstrackingactivewhenfirstresponder | nstrackinginvisiblerect) owner:self userinfo:nil]; [self addtrackingarea:trackingarea]; } 

but somehow feel little unefficient since have 50 instances of custom view in nsscrollview , 5 of them visible @ time , way i'm updating tracking areas of non-visible views.

so thought skip updating tracking areas if view not in nsscrollview's visible rect. like:

- (void)updatetrackingareas { if(!nsintersectsrect([self frame], [[self superview] visiblerect])) { return; } // ... } 

this seems working out i'm not sure if safe.

does have advice on matter?

share|improve question

your answer

 
discard

posting answer, agree privacy policy , terms of service.

browse other questions tagged or ask own question.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -