Custom NSStatusItem with custom view - Use NSWindow, NSView, custom NSMenuItem? - nsview

I'm trying to create a LSUIElement app that behaves like Spotlight, CoverSutra and other apps of that type. I managed to create a custom NSStatusItem, which popups up an NSWindow but the problem is that the app that currently has focus will the focus to my custom NSWindow.
I've based myself on Matt Gemmell's example (http://mattgemmell.com/2008/03/04/using-maattachedwindow-with-an-nsstatusitem)
For example, if you're in Safari and click on the Spotlight icon, the current Safari window does not gray out and keeps focused. When you press ESC in Spotlight, the focus is back to the Safari window.
I haven't managed to do this with my custom NSWindow. I have to click back on a window to set focus back to it.
So I'd like to know which route to go to achieve this. Is the solution a NSWindow, NSPanel, NSMenu with a custom NSMenuItem?

Use NSPanel and NSNonactivatingPanelMask as styleMask or tick the option in IB.

Related

How to make the system menu a toggle button than a dropdown

So I made this simple Cocoa app. I’m a beginner to Swift and was just experimenting with it. This app toggles between hide/show desktop icons by clicking the menu item from the status bar item’s dropdown. I don’t want such a dropdown to happen and rather just directly toggle between show/hide desktop states on clicking it. How can I achieve this using Swift?
A hacky solution that worked for me: Implement the NSMenu delegate method menuNeedsUpdate(menu: NSMenu) to detect the click, remove all menu items and do your click action within this method.
func menuNeedsUpdate(menu: NSMenu) {
menu.removeAllItems()
NSLog("menu clicked !")
}
Don't forget to set the menu's delegate in the same class so that your method will be called.
statusMenu.delegate = self

Showing a overlaying menu when tab bar item is clicked - IOS

Thanks for reading my question!
I have a 5-part tabbar which I use for app navigation, the center tab is covered by a UIButton and is slightly larger (much like the instagram app). This works fine.
But what I want is the far right tab bar item to show a overlaying menu when clicked. I don't want it to switch to a viewcontroller with a menu. I want the menu to be displayed no matter which of the other views you're in at the moment. So I want it to act much like a button which is in the tabbar. But I have no idea how to go about doing this.
Should I use a overlaying button over the tabbaritem or should I catch the tabbarclick, but how can I prevent the view from changing in that case?
Thanks you for any help!
You need to implement UITabBarDelegate. Then override tabBar:didSelectItem: and implement your custom displaying here. See below for reference
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITabBarDelegate_Protocol/Reference/Reference.html
Then i would just make a custom UIView and fade it in when that specific tagged UITabBarItem is pressed.

ios retractable menu?

I'm trying to figure out how to make a retractable menu (left panel) as gmail app or facebook app...
I don't know how to move just part of the front window to show the menu (in another view) when you tap on the corresponding button.
Can you give me some clue on how to do it?
Create a custom container controller and use affine trasforms to the view controller's view.

Tab Bar with popup buttons iPhone

I want to have this type of bar at the bottom of the application and whenever a button is clicked new buttons should popup, which one of them when clicked should take me to its connected view
You shouldn't use Popup as control, I'll recommend you to use it like a notification as this is not Apple way of showing controls.
Here is a nice link from boctor iDev recipes.
You can find here custom UITabBar as well Notification
I would suggest you not to try customizing UITabbar. This will go against the normal behavior of UITabbar and Apple may reject your app for tampering with normal behavior.
You can try having a UIView with a set of buttons in them and bring the similar functionality as in your image.

How to handle sub-content in tabGroups in Titanium Mobile

What is the designated way to handle alternating content in the active tab of a tabGroup?
In my case I have a tableview with a toolbar on top, and when a row is clicked, I'd like to switch the content in that tab to a new content with a different (edit) toolbar.
In the KitchenSink demo app the window is just replaced as far as I can see. Is this the way to go? How are transitions handled?
Thank you for your answers,
Chris
You can open the new window on the current tab:
tab.open(newWindow);
This will use the standard iOS navigation transition animation.
Also, you can configure a window's navigation bar (top bar) without needing to create and add a toolbar using Window properties like title, leftNavButton, rightNavButton. For example, create an edit button and then do:
newWindow.rightNavButton = editButton;
Also, you can create a standard edit button by setting the systemButton property to Ti.UI.iPhone.SystemButton.EDIT.
Finally, to create a system button with any title, set title property and also set the style property to Ti.UI.iPhone.SystemButtonStyle.BORDERED.