Create a standard NSwindow with red, yellow and green buttons - cocoa

Currently I am trying to create a standalone window which is triggered from pressing a drop down button in a status bar icon. I am able to create windows however I am unable to move, minimise or close the windwos and they have the missing red, oragne and yellow butons that are visible in Mac.
Any ideas how to fix?
Edit: to provide more details I am building a Status bar app. I have removed the default windows Views controller from Storyboard and create a new one to make up my "settings" Screen
( screenshot below)
I use the following code to instantiate the window -
let mainStoryboard = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil)
let myWindowController = mainStoryboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "NewWindowVC")) as? NSWindowController
window?.windowController = myWindowController
and it results in the screen with no red, yellow and green buttons
whic isn't movable and doesn't have the buttons on it..

It sounds like you need an introduction to event & window handling under macOS. To get started try reading through the Cocoa Event Handling Guide and Windows Programming Guide which between them cover the principles of handling events and moving, resizing, closing windows in response. If you are opening "document" windows you might want to read Document-Based App Programming Guide for Mac as the document kit handles a lot of the mundane tasks. These are all found in Apple's Documentation Archive along with sample code, and many of these documents are referenced directly from the current API documentation.
Documentation Archive? All these are older guides and no longer being updated by Apple. You should check anything you read in them against the current API documents for the various classes, but the core hasn't changed a lot.
Another answer might reveal where Apple has hidden the up-to-date guides and sample code, but Apple's current documentation includes links back to these old ones...
If you fail to get your windows moving, closing etc. ask a new question showing your code and describing your problem and some will undoubtedly help you along.

Related

Override window drop in Cocoa

I'm looking for a way to customize the drag/drop of windows/tabs. I have a document based app, with a custom window controller. I am able to create tabs for it and have them all along the top, they all show, everything works great with that.
Where I'm running into trouble is if I create a different unconnected windows and start trying to drag windows or tabs into different windows or tab bars to have it dock or merge. Sometimes it works how I want, sometimes it doesn't allow docking or anything. Other times it does what I don't want it to do. I need a way to help it along...
I'm looking for a way to tie into those events but in all my searching I can't find what api or where it is that is controlling the window drags/drops. I looked into the NSDraggingDestination but that has nothing relating to windows, just pasteboard stuff. Looked at NSWindowController and didn't see anything there either. Anyone know if this is possible?

missing alignment guides in xcode interface builder

I am new to programming on the Apple Mac. I have followed a programming guide supplied in the Mac Developer Library to program a basic GUI program called TrackMix. In this program you place a textbox, a vertical slider and a button control on the view window. Initially, on dragging the specific object, say the textbox, to the window, a set of alignment guides (dotted blue lines) would automatically appear on the canvas when the object is dragged over it. I dont know what has happened, but now those guides have disappeared when I execute the same action of dragging objects to the window. When the object being dragged is over the window a small green dot, with a plus sign in it, appears on the bottom of the object. I have carefully retraced my steps to be exactly the same as stated in the Developer Library, but still the problem persist. Have I, perhaps, involuntarily changed some Xcode settings or what? I am at the end of my wits! PS: I am using Xcode 7.
You have to toggle the menu item "Editor > Canvas > Snap To Guides" in Storyboard. I hope that helps
I am not sure whether this will be helpful, but I just had the same problem and the only thing which worked was re-installing Xcode (7.3) and trashing all of the Xcode preferences.
Good luck.

Drop down menu like the default iPad application menus

I'm currently working on my first iOS application to run on the iPad, and I've come across a problem. I have been asked to implement menu's similar to the ones in the default applications such as when you click on the "Calendars" button in the top left of the calendars app.
Only issue is, I cant seem to find a standard UI object that looks like these, with the arrow connecting the menu to the button etc. Is this a standard UI component that I should be able to use, or will I have to imitate them by creating a custom object?
Thanks for any help.
That is a UIPopoverController. There isn't an Interface Builder control for this. You need to create one programmatically:
UIPopoverController *popover = [[UIPopoverController alloc]initWithContentViewController:someTableViewController];
See the documentation for more information and sample projects, specifically ToolbarSearch:

NSWindow Mac App Store like Title Bar

How could I make an NSWindow's title bar look like that of the Mac App Store or of the app Feeder where it's height is increased and other controls are show in it.
To see what I mean just check out the website for the Mac App Store : http://www.apple.com/mac/app-store/.
Is it a custom NSWindow or is it a completely borderless window with an NSView made to look like the title bar?
https://github.com/indragiek/INAppStoreWindow
Title bar and traffic light customization for NSWindow
INAppStoreWindow is an NSWindow subclass that was originally developed to mimic the appearance of the main window in the Mac App Store application introduced in OS X 10.6.6.
The MAS application has since transitioned away from this design, but INAppStoreWindow is still being actively developed to provide extensive additional customization options for NSWindow title bars...
For iTunes (v9.x) Apple used no toolbar, but custom aligned icons and controls in the top bar, to achieve a similar effect. (see link below)
The window looks like a "textured & unified title and toolbar" window to me. (or a slight variant of such)
To reposition the traffic light buttons follow my answer to this question.
However, as Dave DeLong already (similarly) commented: "The UI is terrible. Please don't even think about it."
You can also take a look at http://orestis.gr/blog/2007/09/24/messing-with-windows/ . This uses some undocumented stuff, though, so it won't actually get approved FOR the App Store.

Mac - iTunes status indicator thing

I don't know what to call it, but you know that greenish thing covering most of the middle of the top of the iTunes window, that shows the apple symbol or shows the music slider or the status etc., what is it? I've seen several other applications using it -- how do you get it? I couldn't find it in Interface Builder.
Thanks.
It's not available as a standard component (yet). iTunes is not even a Cocoa app (well, some part of it is Cocoa, but not much.). A few other Apple apps have similar interface element, so let's hope it'll become available in the next version.

Resources