Workaround for annoying NSFocusRing bug in NSImageView

  • For some reason it can be very difficult to get rid of focus rings in
    NSImageViews if [super drawRect:rect] is ever called - apparently the
    class does not consider the value set in

    [myImageView setFocusRingType:NSFocusRingTypeNone]

    I finally figured out a simple workaround - I noticed that the blue
    ring is only present if the image view's 'editable' attribute is set.

    In my subclasses drawRect class I just make sure that 'editable' is
    set to NO when [super drawRect:rect] is called:

      BOOL wasEditable = [self isEditable];
      [self setEditable:NO];
      [super drawRect:rect];
      [self setEditable:wasEditable];

    The darned ring finally goes away...

    The ring also seemed to have a buggy redraw during window resize,
    leaving lots of blue lines all over the place.

previous month february 2007 next month
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28        
Go to today