In the above example image, how do I go about preventing the blue highlight you can see on the top and right side of the NSOutlineView control?
That's called the "Focus Ring". You should be able to stop your view from drawing it either through IB:
Or in code, using setFocusRingType::
[myView setFocusRingType:NSFocusRingTypeNone];
Related
I must achievement somenthing tricky in my application for MAC OS, and because it's not easy to explain I will put an image: custom window
I created the NSWindow from image but the problema is how can create the NSView (the blue one) which is over and which have the purpose to block other action from user and just left small portion to be active. Any suggestion?
You can create a Custom NSView and draw clear color for enbaled rect area and disabled color for rest of the area. Capture the mouseDown event for the custom view and discard all the mouse events outside enabled rect area and if the mouse down in enabled area then call the mouse down event to the control behind the enabled area.
Wouldn't it be better to put up a sheet with a dialog to ask the user for the required information (and prevent interaction with the rest of the window) instead of mimicking a very un-Mac-like UI?
For example, consider the UI when creating a new project or adding a file to a project in Xcode.
If you really must attempt this, don't use a view to cover the window. Use another window. Make it borderless. Set its backgroundColor to [NSColor clearColor] and its opaque property to NO. Set its hasShadow property to NO. Set its frame to match the content rect of the window you want to block (or maybe its frame if you need to prevent interaction with its title bar).
Attach your overlay window to the main window as a child, using -addChildWindow:ordered:.
For the contentView of the overlay window, create a view that will draw the semi-transparent color everywhere except for over the control you want to leave accessible. To get that rect in the main window's coordinate system, you would use something like [specialView convertRect:specialView.bounds toView:nil].
I use the - addSubview: method to add an subview with outline view.
But I found strange that if I programmatically select an object of this outline view, the selection highlighting was not blue:
However, as long as I perform an mouse click on the outline view, its highlighting became normal:
Why did this happen? How can I make the highlighting drawn as blue before any mouse event?
Thank you at advance!
If the outline view doesn't have focus it will use the grey color. Make it first responder, to get focus, and the selection turns blue.
You can make it first responder for example by using NSWindows makeFirstResponder: :
[self.window makeFirstResponder:self.outlineView];
I have a NSButton sibling on top of a NSImageView.
Whenever I click the window, there are some rendering issues. It looks like this:
As you can see, the white edges are the problem.
Strangely, this problem even persists if I override drawRect:.
Nothing gets rendered at all, but whenever I click it, those white edges appear.
Also, when the background-image changes, the button gets redrawn and the edges disappear.
Any idea what might cause this?
EDIT
I found out that this actually happens with every single instance of NSView
and it actually clears part of the buffer (you can see the desktop wallpaper):
EDIT 2
I also just found out that this does not happen if I layer-back the windows content-view.
Well, this question was impossible for anyone to answer.
My window had a custom contentView, which was just drawing a view with rounded corners.
Instead of using self.bounds, I used dirtyRect to draw the background.
So when the contentView wanted to redraw the background of the controls that were updated, those rounded corners were cut out.
I am designing an editable UITableViewCell*. In the normal state, my cell should look like the portion of this image above the red line.
When users click [Edit...], the controls letting the user change the settings will show up, and the text of the [Edit...] button will become [Done]. Clicking [Done] will hide the portion below the red line, and change the text on the button back to [Edit...].
I am trying to achieve this effect by changing the height of the row in the delegate. When the cell is in edit mode, it's returning the full height; when the cell is not in edit mode, the height of the upper portion from the red line on is returned. Unfortunately, when I do that, the edit controls "slide up", obscuring the rest of the cell. I am fixing this by making these controls invisible in the edit mode, but I think there should be a better solution.
Are there settings that I could apply to the controls in order to let me cut off the bottom, clipping the content below the red line?
* I am using Interface Builder to design my cell, in case it matters.
In your xib - just turn on the top strut
This is working for me. To make it smoothly expand and contract you'll need to use the trick of an empty beginUpdates/endUpdates call
[tableView beginUpdates];
[tableView endUpdates];
My question is easy with this drawing :
I have a view above the blue stroke. We can see the buttons behind because this UIView background image is transparent at the left of the button.
My problem is that buttons, behind the views are not clickable.
Is there a way to make them clickable (without playing with adding or removing the view above) ?
Thanks !
Regards,
Sébastien ;)
try to set the
[viewAboveTheBlueStroke setUserInteractionEnabled:false];
because normally the UIView steals the event handling from the other views what it covers (i.e your buttons) and it won't pass them after.
Your image link is broken.
However, you could set the buttonType of your UIBUtton to UIButtonTypeCustom
and then bring them to front:
[self.view bringSubViewToFron:myBut];
You could also consider add UIGestureRecognizers to your image in front instead.