IPhone need design idea for tableview - iphone

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.

Related

iPhone Dev - Implementing checkmarks in a tableview that is in edit mode

I know how to use checkmarks in a tableview when it is not in edit mode. But once in edit mode, it seems that it won't allow me to add checkmarks. Any ideas how to get around this?
Detail accessories are pushed offscreen during editing. This is native behavior and unless you have a peculiar use case it's perfectly fine. If you are editing to sort by checked vs. unchecked, do that automatically. If you really need to, poke around in the methods of your table's delegate. Protocol reference.
Perhaps you can use the built in UIImageView that is on the cell so that when you are editing, if your table allows the editing of multiple rows, when the user taps the cell, the UIImageView is filled with the image of a check mark, but when the table is not in edit mode then the UIImageView is empty.
You can use the allowsMultipleSelectionDuringEditing property of UITableView to decide whether cells are selectable in editing mode.
Then calling indexPathsForSelectedRows will give you the indexPath of the rows the user has selected, and then perhaps you can have some logic to edit the cell's UIImageView property.
A bit hackey, but I hope this helps!

iPhone showing checkboxes and radiobuttons

I will have UInavigation controller and UITableView, it will be long scrolling list,for each cell I need to show some radiobuttons. checkboxes, date entries and textboxes. Since Iphone does not have these controls and considerding that I already Use UITableview and UINavigationContoller what is the best and easy practise here to show radiobuttons and checkboxes?
pickerviews and putting them into a alertshield
show them as tablelist items and multi/checkable
using pickerview popping up from bottom as I have seen in some apps but dont know how to do that?
The second choice is probably your best one. Look at how the Settings app lays things out: that should give you a good idea how to organize your options. Checkbox-able items are usually UISwitches; option-button-y ones are usually rows in a table view, with their corresponding UITableViewCell set to use UITableViewCellAccessoryCheckmark as their accessoryType if they’re selected.
Radio Buttons: If the user has to select one among many items, you can use UISegmentedControl.
Note: This method won't be a good solution if there are lot of items the user has to choose from.
Check Boxes: You can implement this using UIButtons with some images like check boxes or something, and with some logic.
Note: You can also implement radio buttons in this method.
Checkboxes can be done by subclassing UIControl. For future use I've already done this and all you have to do is download the link below from GitHub. Also includes a sample project on how easy it is to use:
https://github.com/Brayden/UICheckbox

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.

Delete cells in table view Iphone with edit button

I have a table view with different cells and basically I would like an edit button which would then make those red circle appear in each cell and be able to delete them. I already know how to make the "Edit" button appear and also I have overridden the commitEditingStyle method for the table view so I would like to know how to link the button to the action which trigers the red circle and how to make them appear and finally how to actually delete the cells thankyou :)
The editing style on your table view cells should be set to UITableViewCellEditingStyleDelete, and then you just need to make sure to call setEditing:animated: on your table view. UITableViewController can help provide a lot of this functionality pre-baked.
That's actually done through an undocumented API (though I'm not quite sure why) - using it would probably get your app rejected.
However, lots of apps simulate this functionality with their own code - you'd basically define a custom UITableViewCell subclass which changed its background color / toggled that extra red circle image when tapped, keep track of which cells had been tapped, and finally delete them all by calling deleteRowsAtIndexPaths: on the table with the collected list of rows.

How to add UITableViewCellAccessoryCheckmark in the middle of the cell in iphone?

In my iPhone application I have used (UITableViewCellAccessoryCheckmark) to add the checkmarks in the cells, - it is added to the cell at the right side of the cell.
I want the checkmarks to display in the middle of the cell and after that a string should display. So that the user can set the cell item as checked or unchecked.
Please provide any solution or any code for adding the (UITableViewCellAccessoryCheckmark) in the middle of the cell.
There is no built in way to do this. You will have to create a cell, then in tableView:cellForRowAtIndexPath: you will need to either add a custom subview, or return a custom cell and tell it to display the custom checkmark you added based on the data state.
The accessory view of the cell is always on the right side, outside of the cell's content view (see the Table View Programming Guide for more on this). If you want to do something like this, you really need to create your own cell class, and draw the checks yourself.
Speaking as a user, this design seems sort of confusing, and definitely not what I'd expect. What's the string you're displaying to the right of the check? Maybe something like the UITableViewCellStyleValue1 style cell would work, instead? (See Standard Styles for Table-View Cells for more.)