简体   繁体   中英

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: 在此处输入图片说明 Result: 在此处输入图片说明 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): 在此处输入图片说明

InAppSettingsKit Source

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM