How can you select editingAccessoryView on a UITableViewCell? - ios

I'm putting a table view in edit mode, with allowMultipleSelection = YES. So, it puts those great circles on the left to indicate a row is or is not selected.
Pressing the cell does select the row. But pressing the circle does nothing.
I've set cell.editingAccessoryView.userInteractionEnabled = YES; with no results.
Is there a property I'm missing or are we just not supposed to press the editingAccessoryView?
Thanks.

If by "little circle" on the left, you mean the accessory view buttons on the right, then you need to implement the method
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
Otherwise, if you are referring to the + and - icons then take a look at UITableView : detecting click on '-' button in edit mode

Related

Edit menu for words in a view in uitableviewcell

How can I show the edit menu for each word that is in each cell in the UITableview?
The picture below is an example of what I want to do. I want to be able to select a word from the label viewed in each cell, and show the edit menu for that word.
You need to put some code inside tableview delegate.
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//fetch the content of label ex: "cell.labelName.text"
//Then put it on text box and allow editing ex:
textBox1.text=cell.labelName.text
textBox1.userInteractionEnabled=YES;
}

Why should I tap twice on tableview cell to navigate to another view in iOS, objective C

In my app there is a table view with custom cell.in that cell there are (image view, views and labels).data loads succuessfully to the table.
Then what I wanted to display another view(detail view) when user tap on the cell.
I did it by (ctrl+drag) cell and connect it with the detail(second) view.
and selected the segue kind as Show.so then,when I click on a cell first time it correcly and and then I have to tap twice to load the detail view. I tried with changing kind to show Detail, present Modally, etc.but the no successful result. Then I tried with using navigation controller within these views.but didn't get any successful result.no idea what to do.I added some code and if you guys want more code I can provide.hope your help.thanx
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
FlightRoundtripDetails *setDetails = [RoundItineraryArray objectAtIndex:indexPath.row];
resultCell.firstdepatairiportCodeLabel.text = setDetails.FirstDepartureAirport;
resultCell.firstarriairportCodeLabel.text = setDetails.FirstArrivalAirport;
resultCell.firststopoverLabel.text = setDetails.Outbound;
}
data display correcly.only the issue is when tap a cell.hope your help.thanx.
I think u have set the tableview selection as Multiple. So goto Attributes Inspector and change the selection to Single.

uitableview have a checkmark on edit mode when selected

when I use edit mode in my tableView,I found there is a round check mark on the left.but i don't want it.how can i delete it?
My editingStyleForRowAtIndexPath is UITableViewCellEditingStyleNone
self.tableView.editing = YES;
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewCellEditingStyleNone;
}
i already uncheck the "Show Selection on Touch" in xib.
and i check the "Multiple Selection During Editing"
It's a result of having tableView.allowsMultipleSelectionDuringEditing = true, which has to be false (or uncheck multiple selection during editing). If you do want to have multiple-row selection enabled without the checkmark, you may have to set cell.accessoryView to something like an empty image. To change the color of the checkmark, you set the cell's tintColor.
settableView.allowsMultipleSelectionDuringEditing = NO
If you dont want that round shape checkmark you can do programatically by selecting multiple rows in tableview. Simply follow below codes :
Result :
I hope you got output as you want. if you still facing any problem let me know.

UITableView willSelectRow method

I have a tableView here, and its cell is a little bit different since I add a textField to the cell in order to input something, the UI looks like this:
while intantiating the cell, I use code like this:
[cell.contentView addSubview: myTextField];
Then, comes the problem:
in the willSelectRow method, I just write this:
- (NSIndexPath *)tableView:(UITableView *)tableView
willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
return nil;
}
But, in the built app, this row can still be highlighted because of a touch, it just soon recover when finger leaves the screen,
I mean, this cell will still turn to blue for a short moment, or in the debugger, it will become blue just before the willSelectRow method returns a nil.
can anyone help me find the problem?
Thanks a lot!
Guess you should also set the selection style to None in the GetCell override?

UITableView delete editing pushes cell content to the right

When setting [self.tableView setEditing:TRUE]; on a tableView the native table delete editing icons appear to the left. But when using a plain styled table these round icons pushes my row background (and content) to the right.
How can I prevent the editing style from changing my cell position, and instead put the icon on top off the cell?
The way it is now it looks like a bug.
Another question on this. Is there some way to define indexPath.row == 0 to not have an delete icon on setEditing:TRUE?
Set cell's shouldIndentWhileEditing property to NO.
Implement delegate's tableView:editingStyleForRowAtIndexPath: method and return appropriate value from it, e.g.:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0)
return UITableViewCellEditingStyleNone;
return UITableViewCellEditingStyleDelete;
}
Ok, found why #1 was not working. I hade set my row background as a view on cell.contentView, in stead of putting it on cell.backgroundView. This way the built in functionality could not separate background from content.
The shouldIndentWhileEditingRowAtIndexPath function will only prevent background from indenting, and not content, as there has to be room for the editing icon.

Resources