Search code examples
iosobjective-cipadios9inappsettingskit

InAppSettingsKit Strange cell content allignment after iOS9 update


I use InAppSettingsKit in my projects. And everything was good befor iOS 9 update. I hadn't this problem in iOS 8. It still work but now cell alignment looks strange. Now cell content has strange offset from the left and right sides.

I've downloaded the sample project and found interesting moment. And edited one cell configuration cell. So in fact cell is green, contentView is red.

    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kIASKPSToggleSwitchSpecifier];
    cell.accessoryView = [[IASKSwitch alloc] initWithFrame:CGRectMake(0, 0, 79, 27)];
    cell.contentView.autoresizingMask |= UIViewAutoresizingFlexibleWidth;
    cell.contentView.backgroundColor = [UIColor redColor];
    cell.backgroundColor = [UIColor greenColor];
    [((IASKSwitch*)cell.accessoryView) addTarget:self action:@selector(toggledValue:) forControlEvents:UIControlEventValueChanged];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

When controller configuring form xib it works good.

Configuration: enter image description here Result: enter image description here So... Normal left and right offsets. Have no any problems. But! after programmatically push.

- (IBAction)showSettingsPush:(id)sender {
    [self.navigationController pushViewController:[[IASKAppSettingsViewController alloc] init] animated:YES];
}

I have this strange result(The same problem in my app): enter image description here

InAppSettingsKit Source

P.S. Any way thanks for your attention. I would be grateful for any help.


Solution

  • This is actually an iOS 9 feature (cellLayoutMarginsFollowReadableWidth) that limits cells to a good readable width. And IMO your second screenshot looks better. (On a sidenote: in your first shot the section titles are incorrectly aligned - not sure what's the reason for this, works fine in the sample app here).

    There's a pull request that allows you to disable this property (default is YES): https://github.com/futuretap/InAppSettingsKit/pull/317

    I'll look into potential side effects and might merge this at some time.