Could someone please show or explain me how to implement a dropdown menu/ filter options to NSSearchField in Objective-C.
My scenario is I have a NSSearchField and a NSTableView on nib. I would like to search Animals|Birds|Reptiles categories.
My NSTableview is connected to NSArray that displays these items and I have done the predicate to filter out to the corresponding search string and it all works fine.
I would like add these categories (Animals, Birds, Reptiles) next to the Magnifying glass icon on the NSSearchField so the user could select from it.
I did download Apple's sample of iSpend demo app but I can't figure it out how they implement it.
never mind I found the solution by adding a nsmenu to searchfield:
Apple's Searchfield Example
Related
Hello i am trying to implement a uitabbarview defined only for search. Ideally i want to implement the exact same style that instagram does Not the suggestions but the actual search bar and the tab controls to switch between the users and hashtags. I've been researching online and haven't found anyone with my exact problem. Any help would be appreciated. Disregard the device and all and just focus on the searchable with the two segmented tabs. i want something exactly like this and ill handle all the search and results etc.
What you will need to find info on is the UISearchBar and especially the UISearchBar delegate method called shouldChangeTextInRange
Find out more about UISearchBar and its delegate methods here
Helpful tutorial here (Filters the UItableView result as you type)
http://s7.postimg.org/suz457l23/IMG_0092.png
I want to use a UISearchBar that doesn't move, like in Apple's Contacts app. I also want to these components at the same depth, and I don't want the search bar in the tableview header.
UINavigationBar
UISearchBar
UITableView
When I try to attach UISearchBar below UINavigationBar in storyboard, interface builder doesn't show me suitable guideline. The guideline only generates when in tableview.
Is there no way to attach the search bar below UINavigationBar without programming?
I'm also searching an elegant way to build the search bar..
What I have now is a UINavigationController, inside which I have a UIViewController.
This UIViewController contains UISearchBar and UITableView. You can program the search bar on top and tableView below it.
vborra's link also helps.
It is easy to do what you are looking for, UISearchBar is somewhat meant for this. See the tutorial Here: http://www.appcoda.com/search-bar-tutorial-ios7/
Dropbox has a wonderful new dropdown view for their menubar app. I have failed to find similiar cocoa examples to duplicate this type of view. NSMenuItem seems to be for basic lists. Any pointers in the right direction?
It's not a NSMenuItem. It is a NSStatusItem that resides in the systemwide NSStatusBar. The distinction is important, because NSStatusItems can call just about any method on any given object of your application when they're clicked.
I suspect that their NSStatusItem triggers an action that displays a borderless window.
You can find more information about status items in the Status Bar Programming Topics document.
I'm attempting to create a log-in window inside an NSMenu (attached to the an NSStatusItem in the menu bar).
I have blank NSMenuItems in the menu. I then set the views of the menu items to NSTextFields.
It ends up looking like this:
The textfields also interact strangely. Clicking on them only gives them focus (so you can enter text) about 30% of the time.
So, I'm wondering:
-How do do I make these look better? How do I control the padding, etc?
-What's with the clicking behavior I described above? Typing only works 30% of the time.
-Are there any other apps that use such a statusbar item as a field? I'd like to take a look.
To answer your actual question instead of discussing the UI design...
Alternative:
Consider using the MAAttachedWindow project from Matt Gemmel:
Download the use an MAAttachedWindow with an NSStatusItem example.
Link:
http://mattgemmell.com/source/index.html
Quickly created example:
Used controls:
- NSTextField (Focus:None DrawsBackground:No TextColor:White)
- NSButton (Bezel:Recessed)
- NSLabel (TextColor:White)
I have a table view where I show chapter title's of a book.
When I touch a cell, I check if there is more than one file to open because some of this chapters have different versions.
So I need something like a subcell which moves in, or a popover where I can choose a version to open.
In my opinion the popover only looks good when you press a button from the navigation bar.
I don't want to open another table view, it should be on the same view.
What could be the easiest and fastest solution?
It's an iPad app.
Greets Max
You can create another viewController for multiple chapters. This should contain a tableView that you load with the chapter options. Then use didselectrowatindexpath to load the data for that viewController with the different chapter options for the selection. If you push the new viewController with a navigationController, then the user can easily navigate back.
However, the easiest thing to do would be to present something like a UIActionSheet with the options (provided there aren't too many of them) or make a custom view similar to it and present that modally ( with presentModalViewController).