How to Change Title Bar Height in Cocoa - Storyboard - cocoa

I am trying to change the title bar height in storyboard(Cocoa). I came across the INAppStore Window, which is not storyboard. How to adjust title bar height in storyboard(cocoa).

I personally used WAYWindow and that worked pretty well but this will work just as well for INAppStoreWindow. It's a drop in replacement for NSWindow so you can select your window in your storyboard and then change its class to WAYWindow in the Identity inspector. After that you can go to the Attributes inspector and change the window height attribute.
You do need to be using an NSWindowController in your Storyboard though. If you use a "show" segue the view controller you segue to will be in a NSWindowController instance you can't change. If you want to have a segue to a view controller where the window has a big title bar and you really don't want to segue to a window controller you would need to have a custom segue.

Related

Change appearance of a popover created using a popover segue in OS X

I'm trying to use storyboards to build a simple app for Yosemite. Creating a popover segue is easy - the segue is created from a button click to an NSViewController in my storyboard, and the Style is set to Popover. This works great, but the trouble is, I'd like to change the appearance of this popover. It seems to be defaulting to a Vibrant Dark appearance, but I'd like it to be Vibrant Light or Aqua. I assume what is happening here is that behind the scenes, an NSPopover is being created to contain the view controller that I am displaying with my segue, but I can't figure out how to get access to this NSPopover object - the storyboard only gives me access to the view controller that I am displaying, and there isn't any NSPopover object available to use in interface builder.
All I want to do is change the appearance of this popover I'm creating in my storyboard...Any suggestions? Thanks!
Override viewWillAppear in your view controller and update the appearance of the view's window:
override func viewWillAppear() {
self.view.window?.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
}
your appearance can be any of the standard appearances

LaunchScreen.xib UINavigationBar & UITableView

I'm unfamiliar with Interface Builder. I typically do everything programmatically. How do I make the launch screen look like a UINavigationController as the window's root view controller with a plain-style UITableViewController as it's root view controller?
I tried adding a UINavigationBar and a UITableView to the LaunchScreen.xib provided by one of Xcode's iOS app templates, but the status bar remains transparent and doesn't automatically match the tint of the UiNavigationBar.
In Interface Builder, how do I set the tint of the status bar to match that of that of a UINavigationBar?
Rather than use Navigation Bar and Table View simply delete the View and drag in a Navigation Controller which comes with both and appreciates the location of the status bar. To get it to build simply delete the Table View Cell.

Xcode tableview hidden behind navigation bar

Can anyone please tell me how to fix the following issue.
I am building an iPhone app using Storyboard. I have a Navigation Controller as root view and off that a view controller. On this I have a few buttons that when clicked takes you to a table view controller. All fine and well, but when I link the buttons to their respective table views, the top navigation bar obscures the top cell in the table view controller.
Does anyone know why this is happening and how I can fix it?
Also it seems to have thrown off my layouts from the view controller from which they inherit.
See attached image for a better explanation perhaps.
I believe this is the intended behavior when using the translucent navigation bar. It's semi transparent specifically so that you can see items pass behind it (e.g. a table scrolling). If you don't want this, changing the navigation bar's style to opaque should solve the problem.
Since I wanted to keep the translucence, I just added a UIView between the navigation controller and the prototype cell (width of the view, height 60). That way the first cell in the table starts beneath the navigation bar but I can still see the scrolling underneath.
This is a bug/feature in IB when you use a translucent navigation bar, the content view runs under the navigation bar. For non transparent bars the content view begins after the bar. If your content view is a UIScrollView (UITableView is a descendent of UIScrollView) the content will be automatically scrolled so as to not be hidden under the navigation bar. So the problem only exist in IB when you run the app everything should be ok.
You just need go to the Navigation Controller properties, then Simulated Metrics, and change the Top Bar to be a Transluscent Navigation Bar WITH PROMPT. And that should be it. No need for that extra UIView

Views of UITabBarController behind NavigationBar

I'm actually having problems by designing my app with the storyboard.
My starting view is a UITabBarController. It has different kind of controllers : UIViewControllers and UITableViewControllers.
My TabBarController has a property : UINavigationBar *navBar;
Indeed, I want to display a navigation bar in my app.
My problem is that every subcontrollers has its view displayed with origin below the navigation bar.
I've get round this problem with the ViewController, by adding a first view, and then adding the others views considering the height of the navigation bar.
But the problem persists, and I can't use the same trick with the TableViewController.
So is their something to set in the storyboard, or in the .m file of my TabBarController, so the others controllers are aware that a navigation bar is displayed?
You should do you view size calculations always based on the dynamic size of the view. E.g.
CGRect newFrame = CGRectMake(10, 10, self.view.bounds.size.width - 20,
self.view.bounds.size.height- 20);
If there is a nav bar or a tab bar, the view will be adjusted automatically and the above will have the expected results.
Besides, it is normally preferable to work with AutoLayout in order to avoid any hard coded sizing.

How to add a bar button item in interface builder?

I am really new to iPhone development and I need help setting up my views.
I have a view that is named FirstViewController.xib and a controller class for this view.
In my MainWindox.xib I have setup a root controller with a moveToNextView function that is connected to the options bar button item.
So when I click on this item the current view switches to the first view and I am able to swticht back. That works fine so far.
The navigation bar at the top of the screen from the MainWindow.xib is displayed in the first view, too. But when I open FirstViewController.xib there isn't any navigation bar defined (but on build&run it is displayed).
This is a problem for me because I want to add a save bar item to the first view. How do I solve that?
Assuming you have a UIViewController (or UIViewController subclass) that is a child of a UINavigationController. Note, I'm using storyboards so your results may vary when using xibs.
If you do not see a UINavigationBar on the interface, try manually changing the simulated metrics.
Drag a Navigation Item onto the view (anywhere). You should now have a place to enter the title in the interface builder.
Now you can drag Bar Button Items onto the nav bar.
You have to do it from code. Add to your FirstViewController class viewDidLoad method:
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:#"Save" style:UIBarButtonItemStyleDone target:self action:#selector(doSave:)];
self.navigationItem.rightBarButtonItem = anotherButton;
[anotherButton release];
Just drag a bar button item onto your nav bar in Interface Builder. Xcode automatically wires it up then you can use it like anything else...

Resources