1

I want to access an enum from another class.

var preferenceButton: UIButton = UIButton(frame: CGRectMake(288.0, view.bounds.size.height - 32.0, 32.0, 32.0))
preferenceButton.setBackgroundImage(image: UIImage(named: @"preferenceIcon"), forState: UIControlStateNormal) // this does not work, because UIControlStateNormal is not known

In the Apple docs this is an example

OBJECTIVE-C

UITableView *myTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];

SWIFT

let myTableView: UITableView = UITableView(frame: CGRectZero, style: .Grouped)

But this does not work for me, maybe because UITableViewStyleGrouped is declared in the UITableView class?

1 Answer 1

3

Have you imported UIKit?

import UIKit

You can also try to specify entire name.

UITableViewStyle.Grouped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.