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..
Related
Actually I am having problem in displaying around 10-15 rows of Label & Button controls in view. Then I used UIScroll view to achieve this but that corrupt the appearance of design.
As you can see the generated output is different from the appearance in the Xcode while developing.
Please guid me what should be done to render proper design?
Thanks
Ashish
You should use UITableView.
Create custom UITableViewCell.
Your each row will contain one UILabel and UIButton.
You can check.
See the attached image :
Create a custom UITableViewCell and use that one in your code.
And in cellForRowAtIndexPath assign values to your cell properties.
Refer this Apple sample code
Also there are so many examples over net, search for custom UITableViewCell and you will find various tutorials out there.
Here is one more third-party tutorial link:
Hope this helps.
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'm working on a project on iPhone and I want a Date Picker on a few of the rows in the table view.
Please help me out.
If this is a StaticCell TablieView, then you can just add these via storyboard.
If not, you will need to use the cellForRowAtIndexPath to determine which cell you want to add the datepicker to. You would then instantiate a UIDatePicker, set the attributes if needed and add that subview to your cell.
One warning - using something this large in an iPhone TableView app will result in a crappy user experience.
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.
I am interested in creating a form in an iphone application similar to this one. Mine would probably have a textbox as well but I was wondering what kind of control(s) should I use? Is this a grouped UITableView where the cells are hardcoded? If that's the case what about events on the textboxes? will they still fire on the tableview level.
Thanks a lot.
Yes, you should use a grouped UITableView. From there you need to create UITextFields and add them to your table view cells. You can either create your own cell, by subclassing UITableViewCell, or you can simply add text fields in cellForRowAtIndexPath.
Then, to receive events from the text fields you need to set the delegate and use the UITableViewDelegate methods mentioned here.
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html
There is an UICatalog sample code in apple develop site, you can check that out.