Date Picker And Table View - iphone

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.

Related

Newbie TableView challenges

I am building an app that requires a tableview control so that users can select multiple rows and act upon them in some way. I find it easy to load my data and display it using the UITableViewController but it seems when I do it this way I am unable to place any other controls on the page, such as a toolbar to give the user some actions to perform on the selected rows. I can place a toolbar control on the form in the storyboard, but it doesn't render in the emulator.
Using a UIViewController and placing a TableView on it seems to come with its own set of confusing challenges (that will make total sense once I conquer them).
Is there any advice for a smooth way of getting a table view with toolbar controls? Thanks!
don't use a TableViewController. Use a Standard ViewController, then add a UITableView to it, and adjust the size. This way you will be able to do whatever else you want on that view without limiting yourself to the tableView only functionality.
When you do this make sure you add the datasource and delegate to the connected table. Then add cellForRowAtIndex, number of sections, number of rows, and whatever other delegate methods you need for your table.
Good luck
Is there any advice for a smooth way of getting a table view with toolbar controls?
Yes there are few ways to accomplish this, one way would be adding a footerview to your tableviewcontroller check these
http://developer.apple.com/
UIButtons on tableFooterView not responding to events
Easier way to add this is using storyboard.
Just drag and drop a view in to your tableviewcontroller, then you can adjust the views size and put anything from objects menu to inside of the view.
Now the problem with that is view will not be stable position at the bottom of the page like a tabbar. Lets say you have only 1 row in your tableview, footer view will go up just below that 1 row, lets say you have hundreds of items in your tableview toolbar will be at the bottom of the rows.
The other solutions for your problem would be either create a custom view and adding it to current view or window (this is little bit adbance),but if you want this just google it.
Or just as you said, create a viewcontroller and put a uitableview inside. Dont forget to add <UITableViewDelegate,UITableViewDataSource> to your .h file and then you can call UItableview delegate methods.\
Good Luck.

IPhone need design idea for tableview

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.

help needed for combo box in iphone

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.

adding combo box to iphone application

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..

UiDatePicker displays but not UIPickerView

If I drop a UIDatePicker onto a UIView in IB and run the app, the date picker displays. If I delete the date picker, drop a UIPickerView onto the same UIView and run the app, the UIPickerView doesn't display. What is the difference?
I believe the issue might be that the UIPicker has nothing to pick from.
The UIpicker lets the user select an item from a list.
You need to supply some options for the user to pick from such as a list of colors where as the datepicker lets the user pick a date and it doesnt need the dev to provide a list of things to pick from.