Can we remove NSPopover's arrow in macOS using Objective-C - objective-c

When I am displaying a NSViewController as NSPopover, I am getting an arrow with this NSPopover. My question is how we can remove this arrow from NSPopover?

I am not aware of any Apple, built-in functionality to do so. However, it is possible to mimic the functionality of NSPopover and have more advanced control. For example, the SFBPopovers library seems a very good choice and has a setDrawsArrow: method: https://github.com/sbooth/SFBPopovers
Here is a picture from the example application with a popover with no arrow coming from the "Toggle Popover" button.

Related

Safari-style tabs Cocoa control?

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.

Creating semi-transparent, round cornered with border Window in Cocoa?

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.

Tab Pages Control Type used in IPad Apps

What kind of controls are used in the photo in the link below i pointed to them with red arrows, its outline+ App, couldn't find any equivalent to it in Xcode.
Kindest Regards
https://dl.dropbox.com/u/49071490/onenote_note_app_outline_plus_for_ipad_1.jpg
The longer arrow left below most probably points to an UITableViewCell which represents one cell in the UITableView, used as a menu. It is customized, though. No control in Xcode that looks like that out of the box.
Concerning the other arrow, iOS does not provide tab bar controls like in a browser. They are custom built from the ground with what you see in Xcode. A lot of thinkable possibilities to achieve that.

Getting textual input from a menubar app? Cocoa

So I created a menubar app (agent application) and I need to find some way to get textual input via the menubar icon. I heard that making a popup modal with a textfield is frowned upon, and putting a text field in an NSMenuItem is bad for functionality. It doesn't even work, when I try.
You could use the new NSPopOver API in Lion. It will create a non-modal window anchored to a particular location, which seems to be exactly what you're looking for.

Creating a custom capture window in Cocoa

I am trying to make a custom transparent bordered window(without tittle bar) to capture a part of the screen.This window should be resizeable from the bottom right corner area,and could be moved by dragging any of the border lines.This window should be such that, it could also be moved over the apple menu.
I am very new to Cocoa, Can you please suggest me some guide or tutorial to understand creating custom windows and the event handling in custom window.
I have seen the example given in the link below and it was pretty helpful,but I am not able to understand the whole code.
http://cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html
Please give me pointers to how to make such a window or what all to refer to have sufficient knowledge to be able to do it.
Thanks :)
The reason that you can't go over the Menu Bar is that NSWindow automatically constrains itself to prevent it from covering that area (along with the dock). In your NSWindow subclass, add this:
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
{
return frameRect;
}
This will override the constrainFrameRect that prevents you from covering the Menu Bar and Dock.