I just started coding for iOS 7 and can't make the title and back button appear in the Navigation item. What can cause this and how can I fix it?
Thanks.
Make sure your ViewController is embed in NavigationController. (Choose your ViewController from Storyboard, then go to Editor menu from Xcode and Embed in -> NavigationController)
Drag and drop the Navigation Item into your ViewController, and now you can enter the title of your ViewController and name for you back button.
Related
I'm on Xcode 9.4.1 and usually there is a "very for Trait" button in the right side of the pane where you can configure the device the storyboard should display. But for one app, I only see iPhone in the device pane (I don't see iPad) and I can't see the "Vary for Trait" button in the storyboard, is there any setting I need to configure to have it shown?
When viewing your storyboard / xib in Interface Builder, make sure the right pane is open (or click the button in the top right farthest to the right)
Make sure you have selected the root view for which you wish to have traits enabled.
Click the document icon to open the general document panel (with the first category of "Identity and Type")
Enable "Use Trait Variations" under "Interface Builder Document"
This will enable the "Vary for Traits" button, along with the various + buttons throughout the document and view options.
Hello all you smart people! I am very new to Xcode 8 and Swift3, and am bringing a new meaning to the phrase 'killer app'. It'll kill me before it gets a chance to provide my pension!!! :-)
My OSX app is a stay resident app in the top right of the apple menu (info.plist set to Application is Agent(UIElement)= True). The main function of the app, executing an applescript, works fine. It is run from the app menu icon or key combo. I've added an 'about' window and the window appears if I select 'about' from the App menu and it closes if I click the red circle. However I can't seem to get an (interface) close button to close the window.
The 'about' window is generated from an NSMenuItem in AppDelegate.swift as in the code below. All I'm trying to do is close said window with a close button in the (viewcontroller)interface. It's that simple but no matter what I try I cannot link the close button in the Storyboard viewcontroller to an IBAction in viewcontroller.swift so as to add window!.close. The only option given is a 'represented object' binding. It's not possible to link to an IBAction in AppDelegate.swift either.
t must be something to do with the way the window is generated because if I build an app with a normal apple menu the interface buttons will link to actions in the code. If anyone can help please email me at pauljvallance#icloud.com and I can send you the Xcode 8.2.1 project and Swift3 code. Best regards, Paul
func windowAbout(sender: NSMenuItem){
let mainStoryboard = NSStoryboard.init(name: "Main", bundle: nil)
myWindowController = mainStoryboard.instantiateController(withIdentifier: "aboutWindowController") as!
NSWindowController
myWindowController.showWindow(self)
}
Xcode 8 appears to have introduced a bug that prevents you from making connections by dragging from an Interface Builder element to a view controller method when the method in question is defined in a class extension. You can however create the desired connection by dragging from your method to the relevant UI element in Interface Builder:
I have a slide up menu in my app that opens when a button is pushed. The problem is when I turn on my app the menu is already open. How do I have the menu closed until the button is pushed?
I figured it out! In inspector view I didn't have my size of the UITextView correct.
I'm building an Application and it needs to have a status bar item and a custom popup window, that popups when the status bar item is clicked.
I know how to set up a status bar item and a nsmenu for it, but I need a custom window rather than a nsmenu.
An example for what I'm looking for would be Take Five by the IconFactory
I really hope you have any ideas how I can do it.
Checkout the following example project by Matt Gemmell:
Using MAAttachedWindow with an NSStatusItem
Screenshot:
In interface builder I added a menu item to the main menu. I can click on the menu and access its contents, however the title of the menu item doesn't show when running the program.
The image shows the application and its menu on top and on the bottom is the application as it appears in IB. Notice that where the menu in IB has the "Calculate" menu option, the running application has in its menu a space instead.
In the menu bar, there is an NSMenuItem which contains an NSMenu. Both have a "Title" property. In Interface Builder, what you see in the menu bar is the title of the NSMenuItem. In the application, what you see is the title of the NSMenu. If the NSMenu's title is not set, then you'll just see an empty string, which is what you've shown in your screenshot.
Click on the Menu item in Interface Builder so that the attached menu shows up. You can then set the title.
Note that in Interface Builder, if you drag a Menu Item to the menu bar, you get an NSMenuItem without any NSMenu attached. I suspect that's what you've done. You can drag a Menu on top of the NSMenuItem to add a menu to it, and then you can set the menu's title correctly. If instead of dragging a Menu Item, however, you drag a Submenu Item, then the attached NSMenu is already present, and it automatically updates the title when you change the text in the menu bar.