How can I make a color chooser for text to use in my cocoa app? I am trying to get the same color selection menu like used on microsoft word. Would this be a popup button or color well or what?
Thanks!
I would personally recommend that you don't emulate Microsoft's UI. It looks very un-Mac-like and you can do better.
You could implement something like this as a popup button and in the button's menu, use custom views for the various color picker sections. Apple's MenuItemView example code shows how to use custom views in menu items.
That's not a standard Cocoa control, so you'll have to come up with your own implementation if you want your picker to look just like that. You'd probably be better off using the standard Cocoa controls for colors, though -- they're used in many programs, so users will already be familiar with them. There's NSColorWell, which displays a single color, and NSColorPicker, which provides a user interface for selecting a color. Read about both in Color Programming Topics.
Related
I'm referring to the Safari 8's tabbar control (which looks almost exactly the same with Xcode 6's tabbar + the horizontal scrolling, if I'm not mistaken)
Is it available somewhere? How do I proceed?
P.S.: If the answer is something along the lines of "It's a custom control. But you can do it very easily by subclassing... everything there is to subclass", I'm prepared for it! lol
It is a custom control: ScrollableTabBarView. You can inspect it using F-Script
The closest visual match is the Yosemite style of MMTabBarView. This control however does not implement scrolling.
Also check out LITabControl and KPCTabsControl
It is just a Segmented / Tab bar with customized Radio buttons with added NSButton(this is for closing the tab).
You could check this using Accessibility Inspector.
And there is no straightforward control to achieve this, as you mentioned in P.S., you should go with customizing the controls.
What would be the best approach for creating a Window that is semi-transparent, has round corners and an outline around its border and the arrow, but without the the title bar and buttons.
The window will pop up from the Menu Bar when a use clicks on the menu bar icon.
I'm looking to have an effect similar to the "Applications" and "Downloads" windows:
I guess I will need to do the drawing myself. But I'm wondering what's the best way to do this and whether there is anything already built into Cocoa that can minimize the effort? Or maybe a 3rd party project that has already done that (couldn't find anything exactly like that)?
Thanks.
You can create your window with
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
with a style-mask of NSBorderlessWindowMask which will give an unadorned window. Its how the Dock does its mechanics too.
Note that you must init with this style , you can't change an already init'ed windows style.
Place a custom NSView via the contentView accessor with your desired background custom drawing at the top of the windows view stack.
You might need also to setOpaque to NO
What you are looking for has been done a lot. Too much really.
The classes you want to look into are as follows.
NSStatusItem
This is something that appears in the status bar section of the menu bar to the right side.
NSMenu
If you want this from a menu in the application menus, you'll need to do some clever things with views in menus.
NSWindow
As the other poster notes a borderless window is one way to achieve this.
NSPopover
This is another way. Combined with the above, a fancy technique is to use a clear window called a cover window then, when clicking on the menu or status menu, invoke a popover from a point below that in the clear cover window.
That should be enough to get you started with what you should look into.
Beyond that, peruse the Mac App Store and also look at cocoacontrols.com and GitHub.
I'd like to customize my UIToolBar, so the centered button looks something similar to the check-in foursquare button.
I've seen a commercial source code called ALToolBar, wich is similar to the effect I want on my UIToolBar. So in resume, changing the height of a button, and the background of a specific button, if that is the right way to go.
I'm pretty new to iOS, but comfortable enough to dig ideas the community can bring on.
Thanks for your help.
One approach is to just write your own Tabbar/Toolbar instead of using the built-in classes. Subclass UIView and add UIButtons for each item, which you can then customize as you wish.
The downside to this approach is, you loose the "More" functionality, that allows you to drag-and-drop items into the Tabbar, but if you just have 5 or fewer items, that's fine.
I am trying to create an instance of NSWindow that has a style similar to that of Pixelmator, pictured below:
http://ideaorange.com/files/2010/12/pixelmato-sprinklebig.jpg>">
Basically, I would like to know how to create a window similar to that style, with the black title bar. Would I have to write the entire window out in code? Or is it possible to do in interface builder? Much appreciated.
The HUD appearance is what you're looking for. Note, however, that it only applies to panels (like Pixelmator's palettes), not standard windows (such as document windows). It also does not apply to controls, such as buttons; Pixelmator's are undoubtedly custom.
This tutorial is a good place to start: http://cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html
There's a load of work involved in developing your own windows so be sure you're up for the challenge.
And another note, be sure to review your code against Apple's AppStore policies, as some of the window theming examples out on the web do use private API's which Apple won't approve for distribution through the app store.
I designed a web app for iPhone and am now trying my hands at a native Objective-C version, and I'd like to retain some continuity with my original design. Since my web version uses CSS, I was able to customize the color palette, even though the UI was designed to imitate a native iPhone UI. I'd like to use a similar color scheme for my native app, but it doesn't seem so easy out of the box. I've gone through a couple tutorials and played around a bit with Interface Builder, inspecting the individual settings available for each control. My biggest questions are:
Is it possible to (or how do I) change the color of a Round Rect Button?
Is it possible to (or how do I) change the color of cells in a Table View?
Where in the Cocoa Touch Library can I find the standard iOS UI buttons, e.g. the green "Call Back" and red "Delete" buttons in the native voice mail?
Thanks
Nope, I don't think so. And you probably shouldn't anyways. In my opinion it's better to rather stay consistent with the OS and not the web... What you can do is to use a custom image.
UITableViewCell has a property named backgroundView, which is only present if you have a grouped style. This view has -- just like every other view -- a background color. If you don't have this and want to color individual cells, build a custom cell where you put in a view as background view.
As far as I know, they are not publicly available. However, you may find a lot of template images etc on the web that you can use.