Reputation: 12446
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
UITableView *myTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
let myTableView: UITableView = UITableView(frame: CGRectZero, style: .Grouped)
But this does not work for me, maybe because UITableViewStyleGrouped
is declared in the UITableView
class?
Upvotes: 1
Views: 1032
Reputation: 14329
Have you imported UIKit?
import UIKit
You can also try to specify entire name.
UITableViewStyle.Grouped
Upvotes: 3