XCode Show Focus Ring - objective-c

I have a NSButton in my XCode project which gets enabled and disabled.
When it gets enabled, the user doesn't really notice, nothing stands out, the text just goes from grey to black.
What I'd like to happen, is to manually show the button's focus ring, or any other type of highlight when the button gets enabled. I've looked online and I can't find anything, leaving me to think it can't be done?
Can anyone help?
I'd imagine it'd be something as simple as:
[myButton setFocusRing:visible];
Thanks everyone.

[window makeFirstResponder:theButton];
should do it.

Change following setting.Go to System Preferences >> Keyboard >> Shortcuts tab >>Enable "All controls" radio button in bottom left corner.

Related

Connecting IBAction to a button in xcode5

I've been following this guide carefully and I got stuck here.
Click here
When I try to connect press ctrl and drag on my button, a popup comes up giving me options "Leading space to container, Center Vertically in container, Equal widths, equal height Aspect ratio" I don't see the option to press my button like in the guide. I read the comments below and it seems like everyone is having this problem. I know it's an old guide so that's probably the reason why
Just right click on the button and then you can normally drag from touchUpInside action to your view controller.
Instead of control-dragging from the storyboard to the storyboard, open up the Assistant Editor with the .m/.h file you want the action code to be in, and control-drag the button from the storyboard to somewhere in that document. Then you should be able to pick between IBOutlet and IBAction.
Hope this helps!

Full screen app with NSToolbar

This is hard for me to explain, so please bear with me for a minute.
In Xcode, if it is in full screen mode, showing the app's menu also moves the toolbar down. I have tried to make an NSView move and resize whenever the menu bar is shown, but I cannot figure out how to do it. I think this has something to do with and event, because setting struts and springs in Xcode does not make it move automatically. Can anybody help me figure out what the event is?
Edit: I just re-thought my question, and I have to make a correction. NSToolbar does this on it's own. I want a normal NSView to move and resize itself when the window goes into full screen mode.
I think you might be having the same issue as I was - if so, you need to call [NSToolbar setFullScreenAccessoryView:] on the "accessory view" you want to glue to the bottom of the NSToolbar.
Note that in windowed mode, your accessory view should take up space in the NSWindow's contentView just like any other view, but when you enter fullscreen mode you'll want to remove the accessory view somehow since Cocoa rips it out of your layout and leaves a gap unless you account for that.
I can certainly understand this issue being difficult to explain without having the background knowledge - I had the same problem. :)
Also see: How can I get a two-row toolbar like in Mail.app and Xcode?

Inline drawer Xcode?

I don't really know what it is but the icon on the top right of a finder window, (oval shaped button) when clicked hides the sidebar and toolbar icons, how can I implement something like this in my XCode project?
Thanks
As far as I can tell, this is just a standard NSButton that has a particular action bound to it. Adium has a similar button and is open source, you might try reading through the source code to see what they've done.
http://trac.adium.im/wiki/GettingNewestAdiumSource

adding an invisible button to the background in IB

I'm working with Xcode doing a Ipad app.
i simply want user to click anywhere on screen (not counting text fields) to perform some IBAction.I'm using an invisible button that covers my whole view.
Since I have some text fields in my view,i need to add this invisible button to the background of my user interface. I cant seem to find this option in the button attributes? any help?
Just set the button's type to custom.
Did you try setting the opacity of the button to zero?
I guess i got your point. You just want to put the UIButton(invisible) on the back of all the UITextField. The simple solution to this is open the Document Window in the IB. Now expand the view tree in the list view. Just drag your UIButton above the UITextFields and set the alpha value for the button in the property to be zero.
Hope this helps!!
iPad users don't "click". They "tap" or "touch".
In Interface Builder, I believe views are constructed with a z-index from top to bottom as they appear in the document window, so dragging your button so that it appears as the first subview of your main view should be a quick fix for this.
Have you considered other approaches? This doesn't sound like standard behaviour for an app and will probably cause havoc with anybody using Voice Over. What are you trying to accomplish?

NSBorderlessWindowMask Window wont show NSPanels if not front most window

I have a window that is set with NSBorderlessWindowMask, and also kCGDesktopWindowLevel. When a NSPanel is supposed to appear from say the selection of a Dock Icon menu or a Status Bar Item menu, the NSPanel will not display if the application is not the front most window.
So this program at this time only has a Status Menu Item (think how QuickSilver is implemented) and when I choose Preferences from my menu it is set to show the Preferences Panel by using Makekeyandorderfront, however unless you have just launched the application and done nothing else, when you select Preferences nothing happens.
I have found that when I choose my menu item for Sparkle's Check for Updates, that the check for update panel will appear and then my preference panel which I told to open will appear.
So it seems like makekeyandorderfront is not really bringing it to the front, perhaps.
Does anyone know how to fix this?
Should I call something besides makekeyandorderfront, or maybe something in conjunction with it?
Thanks in advance
Panels are designed by default to work this way. They're designed as auxiliary windows for your application and always disappear when the application deactivates. You will probably also run into issues with the panel becoming key... but to cure your disappearing panel issue, send this message to your panel:
[panelObject setHidesOnDeactivate:NO];
You should probably be using actual NSWindow objects here instead of NSPanel objects, but since I don't know much about how your application works, you'll have to look into that yourself. For more information on the difference between panels and windows, please review the documentation here: Window Programming Guide