0
我是iOS開發新手。我正在學習Swift。我目前有一個問題,我添加一個導航視圖控制器後,我的tableView不再顯示任何東西。我不明白爲什麼。請幫助我的專家!爲什麼不在嵌入時顯示UITableView UINavigationController
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let mainVC = ViewController()
let navigationVC = UINavigationController(rootViewController: mainVC)
window?.rootViewController = navigationVC;
window?.makeKeyAndVisible()
return true
}
代碼中的ViewController:
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var myTable: UITableView!
var items: [String] = ["Date Picker","List of Data","Slider","Show Image", "Web Display"];
override func viewDidLoad() {
super.viewDidLoad()
NSLog("Hello World at console");
var nib = UINib(nibName: "ListCell", bundle: nil)
myTable?.registerNib(nib, forCellReuseIdentifier: "ListCell")
// Do any additional setup after loading the view, typically from a nib.
}