Present a UITableView as drop-down list using the iOS SDK - iphone

I want to implement a drop-down list in an iPhone application, the same like you might have seen in iBooks when you select PDFs/Books.
I have a slight idea how to implement it, just correct me if I am wrong:
Create the button
On a click event of the button define a CGRect and within the CGRect draw a LoadTableView
Load TableViewData at runtime.
Is that correct? If not, how should I do it?

Here's a much better/easier way to do it.
Create custom UITableViewController and associated nib. Use this class to encapsulate your tableView and data.
When the user clicks on your button, instantiate your custom view controller and display it modally using presentModalViewController:animated
When the user has selected an option from your popup view, call back to the parent view with the results.
Dismiss your table view with dismissModalViewControllerAnimated:
This is what iBooks does with a highly customized UITableViewController.

Are you looking for a UIPickerView?
This component gives you the possibility of selecting from a custom number of elements through a dedicate table view. Use it in conjunction with a UIActionSheet to get the best results.

Related

how to add DropDownComobo in uisearchbar ios

I want to add one dropdowncombo in UISearchBar like mail application (NSTokenField).
On clicking that combo it will display the list of items. I have read many blogs but there is no public control from Apple. Is there way to do this?
NO. you have to use UIPickerview or UISegmentedControl to create a drop down menu.
If you want custom control,you can check this link:-
https://github.com/katokichisoft/KSPopoverView
if you need any further assistance..please reply to me..
you can also use action sheet..Its upto you..
enjoy..
There is no build in control to make dropdowncombo. Instead you can use picker or as in mail application there is a custom controller. you can make it Simply by a table view on a view and presenting it. You can also show the list of Items in the UIPopOverController by adding the controller having table view and manage the content size of the popover.

How to make a combo box in iphone/ipad?

This is maybe a simple question, but I don't have a clue the keyword i had to search for this...
I want to create a simple selector (I called it spinner in Android). This is what i want to achieve
Or it will take a whole screen if it's in ipod touch / iphone.
So, I have 3 button that represent filter (category, country, sort) for a ListView... and if I press one of the button, a popover / dialog should be appear to select the filter for each button.
thanks...
Please let me know if I need to add some information to make the question clear.
Its not so much typical that is it appearing.
Create a new UIViewController class with xib and adjust view size you want to display for combo box or popviewControoler. Then put navigation controller over and tableviewController.
And customize your UIViewController using its controller class. Controller class will be reponsible for displaying and selecting data.
Now in your MainViewController From where you want to show ComboBox or popviewcontroller.
declare popViewController instance variable,synthesize it.
implement a userdefined method here alloc your popviewcontroller class and assign it to popviewController instance variable of your class.
Then called it didSelectRowAtIndexPath.
When popover dismiss you set popViewController result in instance variable of this class so it can easily access in MainViewController class.
You can achieve combo box like functionality by adding a UItableView in a UIView and implement all the delegates of UITableView in that custom view.
Now you can add object of that custom UIView where ever you want that combo. Just you have to workout with some Frame setting.

Load view with popover?

I have a main view with a UINavigationController and a subview (both added through interface builder). I have a UIBarButtonItem in the navigation toolbar. When that button is clicked, I want a popover view to come up (with a table format) with options for different subviews to choose from. When a user chooses one of the subviews (by clicking a cell), the popover should fade away and the subview should change to the user's chosen view.
Those view options should be loaded from separate xib files.
I know it's a relatively complicated question, but what is the best way to do this?
I don't necessarily need code, but that would be helpful. Thanks guys!
Check this tutorial about the popOvers:
http://mobiforge.com/designing/story/using-popoverview-ipad-app-development
Are you looking for something similar to this?
Checkout the – loadNibNamed:owner:options: of NSBundle(UINibLoadingAdditions). Your view will be the first index object of the returned array commonly.

Cocoa Touch drop down box on iPad

I am implementing an iPad app that needs to make use of a drop down box or something to filter items in a tableview.
Can anyone suggest a control? I can't use the picker view (because you can't adjust height) and the segment view can't hold enough items.
In this instance, I'd be tempted to use a UIPicker view in an UIActionSheet. (Or other similar modal dialog.)
That said, it might be more appropriate to use a Search Controller to filter the UITableView. (Really depends on the application.)
Sounds like you could just use a Search Controller to me, is your data categorisable? You could be better off just creating a hierarchy and navigating through it using a Navigation Controller to move between tableviews.

iPhone, how what I show smaller views ontop of normal view and switch between my current normal views?

I'd like to display some small tutorial dialogs on top of my exiting views. I want to be able to see my existing views behind these smaller views.
Do I have to use view controllers in the same I way I would me normal views, and presentmodalviewcontroller etc ?
I haven't tried making a smaller view in interface builder before.
Also, say I want to move to another one of my existing views, full screen, while in my tutorial view. How would I close my tutorial view move to the next full screen view and launch another tutorial view ?
Example code or pseudo code would be welcome.
If your tutorial dialogs are just text, you could use UIAlertView to show the information to the user, so they can just read it and click the OK button when they're done. It's a very easy way to show some text to the user.
If you need to include images or other interactive items in your tutorial dialogs, the easiest way might be for you to just have your fullscreen view's view controller create a new view and put it up. So in this case, you'd create your view in Interface Builder, and when you want to show it, instantiate it using -[UIBundle loadNibNamed:owner:options:] and add it as a subview of your main view. Of course, it may even be easier to create the tutorial view programmatically from your view controller rather than using a nib for them at all.
Regarding the question of moving on to another fullscreen view, you would probably want to look into embedding your view controllers in a UINavigationController. This would allow you to push from the first controller to the second very easily, and the user would be able to just tap the Back button to get back to the first. If you're not looking for a navigation bar type of interface, you could present the second view controller as a modal view controller by calling -[UIViewController presentModalViewController:animated:] on your main view controller. This will pop up the second view controller fullscreen, and the user can dismiss it when they're done. Check out Apple's great documentation on UINavigationController to get a feel for how to use that:
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/NavigationControllers/NavigationControllers.html%23//apple_ref/doc/uid/TP40007457-CH103-SW1
I would think that you could use existing UIViewController and simply add a new UIView that is of desired dimensions, that sits in front of other views and which is non-opaque and has alpha less than 1.
If you want a general purpose tutorial mechanism that can be placed atop any one of many UIViewControllers, then you would want to extract the navigation logic, etc.
Sorry, no code - just a few quick thoughts.