weird storyboard item positions in Xcode8 - xcode

I have been having a problem with the Xcode8 storyboard. Whenever I embed a table view in a navigation controller, the various items (labels, buttons, etc.) that I drag into the cell will have a weird vertical offset. Basically, if there is a label in the cell, I will have to click below where it actually is to select it. Anybody else ever had this problem?

Related

Create Back Button with Storyboards

I currently have 3 tabs connected to a common UITabBarController. When one of the tabs is selected the user is taken to a UITableView with 3 cells which can be selected. When a cell is selected the user is taken to a new page with a UINavigationBar at the top. My understanding is that the UINavigationBar is supposed to include some sort of back button and I couldn't figure out how to enable it.
In place of the default back button, I dragged a UIButton to the corner and connected it to the 'Show Detail' property of the previous view but when I press the UIButton I am taken to the right UITableView but the tabs are missing for navigation. What am I doing wrong? My segues look like this:
The UINavigationController has the back functionality. How to go back one view in UINavigationController?.
Here is some old tutorial on how to combine that with a tabbarcontroller. should still be the same principles.

Overlapping cells in static tableview built using storyboard

All,
I'm using the Xcode 6 beta to build an iOS8 project using storyboard and swift. In the storyboard, I've created a Table View Controller as my primary view when the application loads and have added a label to the first cell and a label to the second cell.
The table looks fine in the storyboard, but when I run the application, the cells overlap. This is a brand new project with no other changes made or code added.
You can see both the storyboard and the running application in the photo below. Any ideas on what could be driving this?
Additionally, when I try to add a button to one of the cells, I get a grey box that covers 90% of the view.
I think I've had this issue. Try making some Auto Layout connections from the label to the Content View of the cell, and from the table view (and its cells) to the containing view, to force the views to be the proper size.
The following worked for me.
Control-click and drag from your label to left side of the cell it's in. When the modal comes up, check the box for 'Leading Space to Container'.
Repeat the same Control-click and drag process for each side of the cell, selecting the relevant Auto Layout option when it appears.
(Optional) Try to Control-click and drag from your table view to the each side of the containing view (if there is one), and repeat the steps from above.
Hopefully this works for you.

How to implement NSToolbarItem Drag/Drop behaviour?

I have a typical cocoa application. There is a toolbar item on the toolbar, current behaviour is to draw a rectangle in the view of main window whenever this toolbar item is clicked.
However, now there is a new requirement: user needs to be able to drag this toolbar item to a position in the main view so that the rectangle will be drawn on that position (where user release the mouse to drop the toolbar item).
I checked the apple dev document at https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSToolbarItem_Class/Reference/Reference.html and https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/Toolbars/Toolbars.html#//apple_ref/doc/uid/10000109i , but cannot find any method related to this.
Could anyone know how to do it? Thanks.

Device orientation using storyboard and uitableview problems

I am using Xcode 4.3.3 and storyboards i have a UITableView but when the device orientation changes from portrait to landscape the spacing is all messed up i also do not have a .h or .m file for my tableview because the cells are static any help is appreciated
Modify the struts and strings of your cell, label, etc in the size inspector of the utility navigator (Select what you want to modify and press Command-Option-5). In the box labeled Autosizing, select and deselect the connectors and arrows to make the item show up in the correct way. The Example box on the right shows you what the item will look like when your orientation changes.

NSWindow's title as indicator popup button

I'm trying to make my first Cocoa app (previously I was making iOS apps) and what I wish to do for my custom view is make it's title clickable with indicator (accessory) triangle facing down.
Clicking the title would open a popup/menu with my items.
How is that doneable in Cocoa?
Rdelmar's answer is probably the easiest way to go, but may not do exactly what you might want to do (which is replace the actual title with a pop up item, instead of having a popup button under the title in the toolbar area). With respect to functionality your application will probably work just as well using the toolbar.
If, however, you truly want to replace the actual title, the means of going about this would be to set the NSWindow title text to #"" to hide it, and redraw it by sticking in your own view.
[[[theWindow contentView] superview] addSubview:theSubview];
This basically tells the superview of the main content view to add another subview (direct "translation" from the code), and you'll have to tinker with the frame of this new subview to have it be positioned where the title should be positioned (as now it's free to be placed anywhere in the window frame, including on top of the title bar, as opposed to simply inside the content view).
theSubview can be your popup button, or whatever you want, and you'll also probably have to custom draw the popup button to match the original drawing of the window title.
You can do this by adding a toolbar to your window in IB. Once, you add the toolbar, you can double click on it to open the customizer view of it. Drag a popup button into the Allowable Toolbar Items area and after it is inserted there you can drag it into the bottom area which shows the layout of the toolbar -- you can also drag out any of the default items there that you don't want.

Resources