Please help me to create drop down box using iphone. I tried in pickerview with textfield but not worked as my requirement can u suggest the url for to solve this problem. The data should come from xml and as a select option in html.
The easiest way is to use a UITableView with the options, which upon selecting a cell, returns the value of that cell to whatever control that has the select.
For the select you can use a button with a custom image for example, and show a table using presentModelViewController.
When the TableView shows and a selection is made, you store the selected value and dismiss the tableView using dismissModalViewController.
I had the same problem where the Picker just did not fit my requirements and used the tableView solution.
Related
Hi guys i have added a picker view to pick areas from it.This picker view contains more than 200 areas so it is difficult to scroll and select from picker view.
Is there any way to add a search bar and connect it with picker view?
I tried doing this by using search bar delegate method by overriding it but i am not able to achieve the goal.
So please help me so that i can do it or if any another way possible then also tell me.
Picker view is for small number of selection. Use table view instead for such big number of options.
Just to back up my statement, the Apple Human Interface Guideline says
Consider using a table view, instead of a picker, if you need to display a very large number of values. This is because the greater height of a table view makes scrolling faster."
I agree with barley that the PickerView is an awful vehicle for large selections; if at all possible to use something else, that would be appropriate and best, but having said that:
The YHCPickerView looks promising from:
http://code4app.net/ios/PickerView-with-Search-Bar/509fb2e86803faf25c000000
From a cursory view of that class, it appears that it has several different and distinct UI elements, the text field for collecting search criteria, the button for enacting the search, and the basic picker view. The search criteria simply and directly filters the picker data/model when the button pressed event occurs. That way you are simply editing the actual data from the picker.
If you handle each of these separately it should make it simpler to create what you want, since you only have to handle the basic functions and delegates of each individual UI element and linking together their effects rather than trying to hijack an existing delegate.
-Cheers
i have a UITableView where i want one cell(database row) needs to be default,
So I am thinking of two options
in TableView upon clicking a cell, change accessoryType to mark just like ringtone selection in settings app
when user enters data, add an option (like radio button or segmented control) to make that cell (database row) as default one
I feel first option is good but we can implement code for that only in didSelectRowAtIndexPath but i need to jump to another view when user click on a cell.
So please give me an idea how to accomplish this
One idea iam thinking is adding an edit button but don't know whether its possible or not.
Thanks
Not sure if i understand your question correctly , but according to what i understand you want a table view in which many values will be there , and you want one value to be default which can be changed later.
According to me these ways would be pretty good,
Changing the accessorytype of the tableViewCell. (Most common way)
Changing the Highlighted property of the cell on loading the tableView.
Adding some image then setting the image as the background view of the selected cell.
Adding custom image view (such as tick or something and adding to the cell).
this code can be put in the viewDidload so your default selected value appears.
Hope this helps.
Don't know what you mean by default. I'm assuming you mean already selected. You might just want to set the accessoryType to the checkbox. That would be Apple's way of doing it.
I have found out articles itself but I didn't find any particular solution for this, whether to use tableview or pickerview.
If anyone can explain this with example would be great.
Thanks for all your help!!!
-
Ankita
Table views are commonly used and work nicely in interfaces where a drop down list would be used on other platforms. You can simply add a UITextField above the table view to mimic the functionality of a combo box.
check out the date cell code sample...
it shows how to use the date picker to set the date in a table view cell...
you can use a normal picker view similarly..
I want to make a grouped TableView similar to the Apple iPhone contacts application.
I need a lot of standard fields which can be edited, but I would only like them editable once the edit button in the navbar is clicked.
This has been bothering me forever that I could not find a good tutorial.
Thanks in advance.
This is not easy. I just built the same thing because there is nothing available from Apple. I ended up creating a single table cell with a UILabel and a UIView on it. The UILabel is for when the cell is in read mode, and the UIView is for editing. The UIView contains a number of UITextFields. These are the individual fields. I also had to implement drawing code to draw the lines between the fields. Then I had to come up with the code to pass in an address object, load it into the fields, format the text for the label, switch in and out of editing mode (with animation), and finally handling saving of changes and canceling. As yet it doesn't handle tapping the address type to select that from a popup list, but I have most of the code in place for the rest.
This could have been done using individual table view cells for each field. But then you can't select the whole thing the way it does in contacts and adding and deleting addresses becomes trickier.
How we can perfectly achieve dropdwn listbox in iphone...And instead for this I want if suppose i pressed button then it will display the UITableView or UIGestureView or UIPickerVIew....
Which one is more suitable instead for dropdown listbox.....
please help my question.....
I'd go with a pickerview for relatively small number of list items and would prefer a table with a searchbar and a checkbutton accessory for a huge list.