Remove white line next to reorder control on grouped UITableViewCell?

What is happening is that when UITableViewCell shows the reorder control it also adds an empty, 1 pixel wide, white UIView to its array of subviews.

Up vote 7 down vote favorite 12 share g+ share fb share tw.

I've built a custom UI for my table that has a darker UI and a custom accessoryView. When I put the table into editing mode, there is a white line to the left of the reorder control that I can't seem to get rid of. TableView:accessoryTypeForRowWithIndexPath: doesn't seem to be appropriate for getting rid of it since I'm not using a standard UITableViewCellAccessoryType, so I'm not sure of what I can do to get it to not show up on my cells.

Iphone cocoa-touch uitableview uitableviewcell link|improve this question asked May 17 '09 at 13:09Justin Williams319313 71% accept rate.

What is happening is that when UITableViewCell shows the reorder control it also adds an empty, 1 pixel wide, white UIView to its array of subviews. Bluntly: this is a bug that Apple should fix. However, you can get around it by finding that annoying view every time it appears and setting its background color to transparent.

Quick tip: the annoying white view is always the last in the UITableViewCell's subviews array and is always 1 pixel wide. We will use this to find it. When you turn editing on for the table, make all of the visible annoying 1 pixel views transparent.

So the action method which toggles "edit" mode on the table might look like this: - (IBAction)edit:(id)sender { tableView setEditing:!tableView. Editing animated:YES; for (UITableViewCell *cell in tableView visibleCells) { if (((UIView *)cell. Subviews lastObject).frame.size.

Width == 1.0) { ((UIView *)cell. Subviews lastObject). BackgroundColor = UIColor clearColor; } } } and keep doing so for all new views as they become visible by implementing this in your UITableViewDelegate: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if (((UIView *)cell.

Subviews lastObject).frame.size. Width == 1.0) { ((UIView *)cell. Subviews lastObject).

BackgroundColor = UIColor clearColor; } } This hack to fix the problem is fairly innocuous and if Apple fix the bug in future (stop adding the annoying 1 pixel view), this code should quietly stop doing anything.

That works like a charm. Thanks Matt. I agree that this is isn't desirable behavior so I'll file a bug with Apple on it.

– Justin Williams May 18 '09 at 2:42 When trying this in Xcode 3.2.4 and iOS SDK 4.1, the object is the second to last, not the last element. This didn't work. – chrish Sep 7 '10 at 16:09.

One trick I use sometimes to "debug" these kinds of problems is to change the background colors of the Views that are the likely suspects. I might set the background color of the TableViewCell as well as its contentView to red or blue and see if you can change the color of the line. That will at least give you a clue as to the nature of the problem and maybe some ideas about how to solve it.

You can actually catch the view and modify it while a cell is transitioned to the edit state. Add (and customize) this method override to your custom UITableViewCell. - (void)didTransitionToState:(UITableViewCellStateMask)state { //modified from comments here: //erasetotheleft.com/post/overriding-the-d... if(state == UITableViewCellStateEditingMask) { for (UIControl *control in self.

Subviews) { // Find the Reorder Control if (control isMemberOfClass:NSClassFromString(@"UITableViewCellReorderControl") && control. Subviews count > 0) { // Do something with the control } } } }.

Thanks for this. I was looking for this reordering control. – Dimitris Jul 1 '10 at 14:24 When trying this in Xcode 3.2.4 and iOS SDK 4.1, the line still shows the first time.

After that it is hidden. – chrish Sep 7 '10 at 16:10.

After trying the solutions from @matt-gallagher and @bryce, I combined the two and created an override of setEditing. - (void)setEditing:(BOOL)editing animated:(BOOL)animated { super setEditing:editing animated:animated; for (UIControl *control in self. Subviews) { if (control.frame.size.

Width == 1.0f) { control. BackgroundColor = UIColor clearColor; } } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions