Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS9 - left utility buttons, visible on first load #353

Open
mfrancekovic opened this issue Sep 23, 2015 · 21 comments
Open

iOS9 - left utility buttons, visible on first load #353

mfrancekovic opened this issue Sep 23, 2015 · 21 comments

Comments

@mfrancekovic
Copy link

Hi,

the lib worked perfectly for me on iOS7, iOS8, but now when building on iOS9, all of the left utility buttons are by default swiped in. User can swipe them out but still it's strange. Wondering what has changed on iOS9 to cause this.

Anybody with the same issue?

@skuske
Copy link

skuske commented Sep 29, 2015

Yes, same issue here, but on iPad (mini 2) only, not on iPhone. Not tested on other devices than those.

Any solutions yet?

@mcicak
Copy link

mcicak commented Oct 2, 2015

I have this issue when changing app width on iPadAir2 multi task split.

@hrushka
Copy link

hrushka commented Oct 4, 2015

Same problem here on iPhone.

@hrushka
Copy link

hrushka commented Oct 4, 2015

So, I'm not quite sure why, but it appears that there is a strange conflict/race condition when SWTableViewCell calls layoutSubviews.

If you set a break in contentOffsetForCellState, you'll see that layout for each cell is called twice. When its called directly via the layoutSubviews method, it sets the X offset correctly, but when called via the [super layoutSubviews] method, the cellState oddly ends up being kCellStateLeft.

Workaround: If you move the [self updateCellState] inside the following If block:

if (!self.cellScrollView.isTracking && !self.cellScrollView.isDecelerating)

It seems to work as expected.

Hope that helps everyone.

@hhp21
Copy link

hhp21 commented Oct 8, 2015

I'm seeing the same issue on ios9 iPads only. @foreignmedia I tried your workaround but without success - in case I misunderstood, you are suggesting we modify the layoutSubview in SWTableViewCell.m to this?


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    // Offset the contentView origin so that it appears correctly w/rt the enclosing scroll view (to which we moved it).
    CGRect frame = self.contentView.frame;
    frame.origin.x = [self leftUtilityButtonsWidth];
    _contentCellView.frame = frame;
    
    self.cellScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.frame) + [self utilityButtonsPadding], CGRectGetHeight(self.frame));
    
    if (!self.cellScrollView.isTracking && !self.cellScrollView.isDecelerating)
    {
        self.cellScrollView.contentOffset = [self contentOffsetForCellState:_cellState];
        [self updateCellState];
    }
}

Thank you.

@hrushka
Copy link

hrushka commented Oct 8, 2015

@hhp21 That's what I had but it seems like that wasn't a good work-around as the issue came back for me as well. I haven't been able to trace it back to the issue, but I'm still seeing my cells being laid out twice. Once with the correct cellState (Center) and one with the incorrect one (Left).

@ibm-ecm
Copy link

ibm-ecm commented Oct 15, 2015

same here

@skuske
Copy link

skuske commented Oct 20, 2015

Fix #353 does actually not seem to fix this. At least not for me... :/
Has anybody a reliable fix for this that works on any (!) device?

@skuske
Copy link

skuske commented Oct 20, 2015

I observed this issue on iPad Mini (2) with iOS 9.0 installed. Now, with iOS 9.0.2 installed, it no longer occurs on my iPad. However, in Simulator with iOS 9.0, the issue is still there if it simulates iPad.
Can somebody confirm that this has been fixed in iOS 9.0.1 or 9.0.2?

@skuske
Copy link

skuske commented Oct 22, 2015

For me, the problem went away after upgrading to iOS 9.1 ...

@rvhelden
Copy link

For me the problem still remains after update IOS 9.1 and Fix #355
Is it possible to close the left utility buttons programmatically?

@qi-wang
Copy link

qi-wang commented Oct 28, 2015

Somehow the content offset is reset to zero during the super.layoutSubviews() call, that would cause SWTableViewCell.updateCellState() to set the cell state to Left when the cell is initially displayed.
I tried to set layoutUpdating to make sure that the cell state does not change during the super call.
The following fix in SWTableViewCell.m works for me.

- (void)layoutSubviews
{    
    BOOL isPad = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad;
    if (isPad == YES) {
        layoutUpdating = YES;
        [super layoutSubviews];
        layoutUpdating = NO;
    } else {
        [super layoutSubviews];
    }

    // Offset the contentView origin so that it appears correctly w/rt the enclosing scroll view (to which we moved it).
    CGRect frame = self.contentView.frame;
...

@rvhelden
Copy link

It worked for me! Thanks!

@edalford11
Copy link

This is happening to me on all devices on iOS 9.1. @qi-wang fix seems to solve it for me by just leaving out the iPad check.

@EGDBE
Copy link

EGDBE commented Nov 7, 2015

qi-wang code fixed the problem in my real device iPad Air. Thanks!

@solidusex
Copy link

Yeah, it worked~~~

@valeIT
Copy link

valeIT commented Nov 14, 2015

worked, thanks

matteogazzato added a commit to matteogazzato/SWTableViewCell that referenced this issue Feb 18, 2016
As described in this issue
CEWendel#353, on the first
load of the view, cells show the left utility buttons. This solve the
problem
@matteogazzato
Copy link

Hi, i've done a pull request based on this issue https://github.com/CEWendel/SWTableViewCell/pull/378. Hope it could be useful.

mattlm added a commit to wavedigital/SWTableViewCell that referenced this issue Oct 13, 2016
@sharonSilicus
Copy link

I think this is again happening on iOS 10.0.1 and 10.1.1 on iPad Pro only

@issambellemallem
Copy link

I have the same problem on Ipad IOS 9.5.3 or heigher

@dipakdipak
Copy link

Instead of this:
if (cell == nil) { cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier]; cell.leftUtilityButtons = [self leftButtons]; cell.rightUtilityButtons = [self rightButtons]; cell.delegate = self; }

I have used following and it started working:

if (cell == nil) { cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier]; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests