I am trying, as the name says, to programmatically configure the UITableViewController. After several hours of trying, I hope someone can help me. And, yes, I checked other posts on this:
import UIKit class MainViewController: UITableViewController { init(style: UITableViewStyle) { super.init(style: style)
and appDelegate looks like this:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { self.window = UIWindow(frame: UIScreen.mainScreen().bounds) let mainViewController: UITableViewController = MainViewController(style: UITableViewStyle.Plain) let navigationController: UINavigationController = UINavigationController() navigationController.pushViewController(mainViewController, animated: false) self.window!.rootViewController = navigationController self.window!.backgroundColor = UIColor.whiteColor() self.window!.makeKeyAndVisible() return true }
Running the program, but as soon as this happens, I get the following error:
fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'HelloWorld.MainViewController'
Then I change the value of MainViewController(style: UITableViewStyle.Plain) to MainViewController(nibName: nil, bundle: nil) , but then I get the following syntax error: Extra argument 'bundle' in call
Any help would be greatly appreciated
uitableview ios8 swift programmatically-created
Nilzone-
source share