You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS9 - left utility buttons, visible on first load #353
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.
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)
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];
}
}
@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).
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?
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;
...
Activity
skuske commentedon 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 commentedon Oct 2, 2015
I have this issue when changing app width on iPadAir2 multi task split.
thepolymatt commentedon Oct 4, 2015
Same problem here on iPhone.
thepolymatt commentedon 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 commentedon 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?
Thank you.
thepolymatt commentedon 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).
skuske commentedon 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 commentedon 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 commentedon Oct 22, 2015
For me, the problem went away after upgrading to iOS 9.1 ...
rvhelden commentedon Oct 26, 2015
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 commentedon 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.
rvhelden commentedon Oct 28, 2015
It worked for me! Thanks!
edalford11 commentedon Oct 29, 2015
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 commentedon Nov 7, 2015
qi-wang code fixed the problem in my real device iPad Air. Thanks!
solidusex commentedon Nov 7, 2015
Yeah, it worked~~~
valeIT commentedon Nov 14, 2015
worked, thanks
Left utility buttons visible on first load
matteogazzato commentedon Feb 18, 2016
Hi, i've done a pull request based on this issue https://github.com/CEWendel/SWTableViewCell/pull/378. Hope it could be useful.
Fixes utility button visibility issue
sharonSilicus commentedon Nov 24, 2016
I think this is again happening on iOS 10.0.1 and 10.1.1 on iPad Pro only
issambellemallem commentedon Nov 28, 2016
I have the same problem on Ipad IOS 9.5.3 or heigher
dipakdipak commentedon Feb 6, 2019
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]; }