Is it possible to customize the multiselect edit mode? So instead of the default selection icon (the circle with the checkmark), I need to show a custom one, with selected and unselected states.
I also need to indent the cell more to the right.
Obviously I would like to use as much as possible of the system provided animations.
HEre's a screenshot of the sample editing mode of uitableview. (My cell is much more complicated :)
Thanks,
Jason
You can customise the cell.. create a UITableViewCell with a UIButton and set the custom images you want for the selected and default states and load this custom cell in cellForRowAtIndexPath:
Related
I would like to set custom icons for the UITableView delete icon for the table's edit mode.
I found a way of doing it by setting UITableViewCellEditingStyleNone in editingStyleForRowAtIndexPath method ant then adding my custom button view in the place where that icon should be by subclassing UITableViewCell. source (enter link description here)
I set up a delegate to get the tap even from that button, but with this approach when I tap on this custom button I can't get the cell to slide to the left to reveal red delete button (see the image). So this way, I can just delete the cell by taping only once.
What I need is to mimic the same standard deletion flow with two taps(first on the left delete icon, second on the delete button the slides to the left) but also have my custom icon for the delete on the right.
Is this possible to do?
Any kind of help is highly appreciated.
For fully customize UITableViewcell https://github.com/CEWendel/SWTableViewCell
It will Help you a lot
I am learning about TableViews in Xcode right now and I am having trouble finding some info on TableViewCell accessories.
My goal is to have a MasterTableView and a SubTableView. When a MasterTableCell is tapped to take the user to the SubTableView. But I'm stuck with something simple like showing a '>' on the right side of the cell to show that it has a SubTableView.
Do I need to design my own button? I thought there was a navigation image already available to me in the UI storyboard maker but it won't let me drag and use it in my custom cell I'm making.
Any thoughts or links to documentation would be great. I've looked in the developer library and all it tells me is that it is possible, not how to do it.
Thank you in advance.
If you are using a Prototype Cell in the Storyboard, just set the "Accessory" type in the Attributes inspector to "Disclosure Indicator".
If you create the cell programmatically, set
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
From the documentation:
UITableViewCellAccessoryDisclosureIndicator
The cell has an accessory
control shaped like a chevron. This control indicates that tapping the
cell triggers a push action. The control does not track touches.
I iOS 5 Apple added functionality to make it easier to make a multiple selection table view through:
self.tableView.allowsMultipleSelectionDuringEditing = YES;
When the table is in edit mode I can see the multiple selection mark but when I check it, it does not display the usual red checkmark to denote it is selected. So I assume I have to programatically access that UIView and set the appropriate image.
So my question is, how can I access the UIView that displays the circle that represents if the cell is selected or not?
(source: winddisk.com)
There is no need to programatically access the UIView and update it with the checkmark.
The solution to the problem was way easier, here it is:
Cells not getting selected in UITableView with allowsMultipleSelectionDuringEditing set in edit mode
I am trying to duplicate the functionality found in the Settings app when managing the Spotlight search options:
I need to be able to rearrange the order of a tableview without an editButton and will need to be able to select/deselect a cell, having the checkmark appear to the left of the cell label.
When I use the following code:
-(UITableViewCellEditingStyle)tableView:(UITableView*)tableView editingStyleForRowAtIndexPath:(NSIndexPath*)indexPath {
return 3;
}
I get this:
This works, but I was wondering if there was any way I could customize the editing style so that the checkmarks are more like they are in the spotlight settings (The red checkmarks look like items are being selected for deletion).
Possible duplicate of: How can i custom UITableViewCell editing style?, but no one seems to have answered it.
Set the editing style to UITableViewCellEditingStyleNone. Instead, create a checkmark image and a "blank" image (the same size at the checkmark image) and use these to set the cell's imageView.image property. You will need to keep track of which cells are checked or not. Toggle this state and the image view from the didSelectRowAtIndexPath method.
How do I change UITableViewCellEditingStyleInsert default image to custom created?
Is there an easy way or I should create a custom UITableViewCell?
The standard API doesn't support any way to customize the green plus button used for UITableViewCellEditingStyleInsert.
Your only option would be use your own button added to a cell. You wouldn't be able to use the standard editing style features of UITableView. You would need to set the cell's editing style to None and use your own method when the custom button is tapped.