I have an app I am moving to ios8 and want to get ride of all the deprecated methods.
The app I have is an iPad app and I have a search bar in my navigation bar and the search result should appear in a popover under the search bar in the navigation item.
I have found the property that stops the search bar from hiding the navigation bar.
but I am still stuck.
Can anyone point me to a some sample code or describe the steps I need to take in order to achieve this.
Regards Christian
This answer is not a step-by-step one, but question and answer might be helpful? UISearchController showing fullscreen instead of a popup on iPad
[self.searchController setModalPresentationStyle:UIModalPresentationPopover];
Related
Just to prove I'm not going mad here's my app working, complete with a Nav Bar.
But this is what it looks like in the Main.storyboard, no Nav Bar.
I have rectified this is the past by disconnecting the link from the TabBar controller and restablishing it. I want to be able to edit Nav Bar as I seem to have two back buttons. One comes up and < and the other as < Back, shown top.
What's the fix and have I created the View in the wrong order?
Many thanks.
Here's an image of where to go if you need a navigation bar in a View Controller.
If you need to add Bar Buttons, you can use a Navigation Item as well.
I'm designing and building a Cocoa app (OX X, not a Cocoa Touch iOS app). I see other apps like Evernote, Chrome or Xcode have complicated, interesting top bars for their windows. How are these designed? Is it a custom window? If so, what is done to add the extra real estate?
A regular top bar looks like:
Evernote's top bar looks like
How are these designed?
They're almost certainly using NSToolbar, a Cocoa class that makes it easy to add a number of icons, buttons, search bars, etc. to the top of a window such that the items look like part of the window title bar. It's impossible to know what they're using just by looking at them, but NSToolbar is one way to get that effect.
Here's a good example straight from the linked documentation:
I'm trying to add a "second row" after my NSToolbar in my app, that remains part of the title bar. As an example, Mail has a thin gray divider line below the NSToolbar with some extras items below that. Very specifically, when the window is put into fullscreen mode, that second "row" stays attached to the title bar as it slides down under the system menu bar. Xcode has a similar story.
I tried setting my NSWindow to textured and placing my second row controls directly in the content view of the window. While this mostly looks correct in windowed mode, those controls of course won't appear attached to the toolbar when it slides down in fullscreen mode. So how can I achieve the same behavior that Mail and Xcode do? I've looked at a lot of toolbar customization code but none of them really cover this specific case.
fullScreenAccessoryView is deprecated in macOS 10.10
In order to do this in recent versions of macOS, use the addTitlebarAccessoryViewController method on your NSWindow and pass in a subclass of NSTitlebarAccessoryViewController.
For example:
NSTitlebarAccessoryViewController *accessoryViewController = [[NSStoryboard storyboardWithName:#"Main" bundle:nil] instantiateControllerWithIdentifier:#"AccessoryViewController"];
[self.mainWindowController.window addTitlebarAccessoryViewController:accessoryViewController];
What I needed to do was call [NSToolbar setFullScreenAccessoryView:] on the view below my toolbar. This results in the behavior I was aiming for. See the NSToolbar documentation for this method.
First one is normal toolbar. For second toolbar you can create a separate view of your desired height and add it in the main landing-window.
I know there have been a million questions asking this, but mine is different. I don't want to just make a navigation bar that you can hover over and view sublevels. I want the actual navigation bar (which I have as an image) to come in from out of sight. What would be the best way to go about this? Coding, Flash, CSS?
First, using a hover event to show a navigation bar can be very difficult for users to use, though is does save valuable screen space to have it hide. If you choose to stick with the navigation that shows after a hover event, keep it very basic.
Check out this link, it uses the same idea... but uses a click instead. Just change it to work with hover instead.
Hope this fixes your problem!
http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html
Safari on iPad has this bar at the top (it isn't called "toolbar" on iOS, right?), with some icons and input are for searching.
How to put such buttons and input field into Navigation Bar? Is it even a Navigation Bar? From what I read a Navigation Bar has one button on the left, another one on the right and one Label in the middle. But how to create something like that "top" bar from Safari?
If I'm in XCode 4.0 and choose "View-based app", should I then set in the ViewController > Simulated Metrics > Top Bar > Navigation bar? And how to add buttons to it?
Edit
Sorry for the confusion - I don't know if the proper way is to add to a Navigation Bar. I'm just asking for a general overview how such "top "bar" is made. What kind of View do such items belong under?
You probably don't want to use a navigation bar. They are very limited in what controls you can put in them. Try using a UIToolbar instead.
I think you may be looking for the UISearchBar
UISearchBar Sample Code
In the interface builder you should be able to just drag and drop objects onto the navigation bar, as for the little icons, those are just buttons with no border and images. Those images are preloaded in the iOS SDK, so you won't have to make them, but if you want your own then you can make them yourself.