escoz / QuickDialog

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

Swift storyboard: tableview appearance not grouped #695

Open twestley opened 9 years ago

twestley commented 9 years ago

I've added QD to a swift project via CocoaPods and bridging header. My subclassed QuickDialogController is one of three controllers in container views. Some of that seems relevant to the fact that the tableview does not appear to be grouped. I've set a breakpoint in initWithController to find that controller.root.grouped == YES and that self.style == UITableViewStyleGrouped. Everything works as expected -- including printing boolValue when selected -- except that the tableview appears plain:

notgrouped

import Foundation

class ControlsViewController : QuickDialogController {

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.root = QRootElement()
        self.root.grouped = true
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        var section = QSection()
        var airplaneMode = QBooleanElement(title: "Airplane Mode", boolValue: false)
        airplaneMode.onSelected = {
            println("airplaneMode=\(airplaneMode.boolValue)")
        }

        self.root.addSection(section)
        section.addElement(airplaneMode)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }    
}

QuickDialog v1.0 (CocoaPods) OS X Mavericks 10.9.4 Xcode 6 GM iOS simulator: iPad Retina (8.0)

SteveGreenley commented 9 years ago

It may be that it worked correctly. If you open Settings in iOS8, that presents a grouped table and it looks just like what you have there.

twestley commented 9 years ago

I think what you see in Settings in IOS8 are sections in a plain style table, not grouped style table. Grouped tables should still be possible, see https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewStyles/TableViewCharacteristics.html. However, I can't find an example in Apple iOS 8 apps. They seem to have moved away from grouped style for their apps.

JoshOldenburg commented 9 years ago

Settings is grouped, Contacts is not. Grouped tables have a gap at the beginning, end, and between sections; standard tables have no gaps and the headers stretch across the whole screen.

twestley commented 9 years ago

I'm having trouble reconciling that with Apple statement (from https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewStyles/TableViewCharacteristics.html):

A grouped table view also displays a list of information, but it groups related rows in visually distinct sections. As shown in Figure 1-4, each section has rounded corners and by default appears against a bluish-gray background. [emphasis added]

What am I missing? Is there another property that needs to be set (in addition to grouped) to get the rounded corners and bluish-gray background? Or perhaps this just can't be done with QuickDialog table views.