escoz / QuickDialog

QuickDialog - Quick and easy dialog screens for iOS
http://escoz.com/open-source/quickdialog
Other
3.07k stars 637 forks source link

Under ios7 on iPad, extra spacing appears in header of quickdialog views #564

Open smuskal opened 11 years ago

smuskal commented 11 years ago

Extra spacing is appearing in the header of quickdialog generated views.

See the difference is spacing from top to "Change Something" section header below.

QuickDialog.xcodeproj example under ios6:

pastedgraphic-8

under ios7:

pastedgraphic-9

nbonamy commented 11 years ago

I have the same issue but even on iPhone. I think the padding at the top of the controller is really too high. Tried to find a way to change this but to no avail...

ios simulator screen shot 21 sept 2013 00 11 59

nbonamy commented 11 years ago

I ended up adding this ugly hack in viewDidLoad of QuickDialogController... Not sure this is generic enough or too specific but at least my app looks fine to me now!

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 &&
            [self.view isKindOfClass:[QuickDialogTableView class]] &&
            [self.root isKindOfClass:[QRadioElement class]] == FALSE) {

        // calc vertical offset
        int verticalOffset = -20;

        // for not first controllers in tab bar
        if (self.navigationController.navigationBar.translucent == TRUE) {
            if ([self.parentViewController isKindOfClass:[UITabBarController class]]) {
                UITabBarController* tabBarController = (UITabBarController*) self.parentViewController;
                    NSUInteger currentIndex = [tabBarController.viewControllers indexOfObject:self];
                if (currentIndex > 0) {
                    verticalOffset += 64;
                }
            }
        }

        // remove more margin if 1st section has header
        if (self.root.sections != nil && [self.root.sections count] > 0) {
            QSection* section = [self.root.sections objectAtIndex:0];
            if (section.headerView != nil) {
                verticalOffset += -12;
            }
        }

        // now do it
        [(QuickDialogTableView*)self.view setContentInset:UIEdgeInsetsMake(verticalOffset, 0, 12, 0)];

    }
renetik commented 10 years ago

Well I "FIXED :)" this with :

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) self.quickDialogTableView.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0);

lancep commented 10 years ago

I've seen this happen when returning 0 from tableView:heightForHeaderInSection: tableViewDelegate method. Not sure if that's the case here. I've fixed this in the past by returning 1 or 0.01 or some other small value.