7

So I just installed Xcode 6GM and fiddled with my iOS7 app on simulator running iOS8.

I have a UITableView that's in editing mode and there's now a circle on the left side of the cell which doesn't appear when running on iOS7.

I glanced at the documentation for iOS8, but I don't see any new constants and I'm using UITableViewCellEditingStyleNone and UITableViewCellSelectionStyleNone.

That circle disappears when tableView.editing = NO, also allowsMultipleSelectionDuringEditing = YES.

If anyone can tell me what's going on that'd be great :)

EDIT: compiling from XCode6GM onto my iPhone running iOS7.1 gives me the circle too. I suspect a bug with XCode6GM?

Here is a screenshot with the circles:

enter image description here

JackyJohnson
  • 3,106
  • 3
  • 28
  • 35
  • Are you able to show a screen shot of the "Left Circle". For your information, there is a new property added to UIView for all the object inherit from it. It might be the "Left Circle" that you mentioned. See: http://stackoverflow.com/questions/25762723/remove-separatorinset-on-ios-8-uitableview-for-xcode-6-iphone-simulator – Ricky Sep 13 '14 at 00:34
  • @Ricky it doesn't seem to be.. this is like the undocumented UITableViewEditingStyle with index 3 that gives you a circle with a checkmark in it when selected, except the odd part is I can't even get it to "check". I spent an hour going thru the new docs and another hour fiddling around before I decided to post on SO. – JackyJohnson Sep 13 '14 at 05:59
  • (In case this is found by others with a slightly different problem.) I was troubled by the overlapping circle too, but in my case I wanted to make use of it. Then I remembered that I had implemented the following: `- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { return NO; }` I changed the return to `YES` and all was well. – mts Oct 11 '14 at 12:56

4 Answers4

6

I just had this annoying issue while migrating my app to iOS8.

Here is the workaround I found ... add something like this in your UITableViewCell subclass:

- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
    [super setEditing:editing animated:animated];
    for( UIView* subview in self.subviews )
        if( [NSStringFromClass(subview.class) isEqualToString:@"UITableViewCellEditControl"] )
            subview.hidden = YES;
}

I hope this will be documented / fixed soon ...

nick671
  • 76
  • 1
  • 2
  • UITableViewCellEditControl eh? wth... but well done! :) – JackyJohnson Sep 20 '14 at 18:32
  • 2
    This is a nice workaround and it seems it's the only way to get rid of those gray circles when the table has allowsMultipleSelectionDuringEditing set to YES. Couple small things I added to that: first, doing it only for iOS 8 by wrapping with - if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) { }. And second, adding a break to exit the loop when the 1st subview gets hidden. – Vitali Tchalov Oct 16 '14 at 19:38
2

I think I have a better solution, add this code to your custom uitableviewcell:

- (void)addSubview:(UIView *)view {
    [super addSubview:view];
    if( [NSStringFromClass(view.class) isEqualToString:@"UITableViewCellEditControl"] ) {
        view.hidden = YES
    }
}
MZD
  • 4,506
  • 1
  • 12
  • 8
  • 1
    That might be risky, who knows what the system is using that subview for. I prefer the original answer that just makes the view hidden while leaving it intact in the hierarchy. – Vitali Tchalov Oct 16 '14 at 19:36
  • @VitaliTchalov Yes, maybe you can set its hidden attribute here instead of bypassing "addSubview" call. – MZD Jan 31 '15 at 13:40
0

Here's a Swift solution combining the two answers:

override func addSubview(view: UIView) {
    super.addSubview(view)
    if view.isKindOfClass(NSClassFromString("UITableViewCellEditControl")!) {
        view.hidden = true
    }
}
Chris C
  • 3,221
  • 1
  • 27
  • 31
0

Here is the Swift3 version:

override func addSubview(_ view: UIView) {
    super.addSubview(view)
    if view.classAsString() == "UITableViewCellEditControl" {
        view.isHidden = true
    }
}
FBronner
  • 1,672
  • 1
  • 11
  • 5