相关疑难解决方法(0)

以编程方式导航到另一个视图控制器/场景

从第一个视图控制器导航到第二个视图控制器时出现错误信息.我的编码就像这个

let vc = LoginViewController(nibName: "LoginViewController", bundle: nil)
self.navigationController?.pushViewController(vc, animated: true)
Run Code Online (Sandbox Code Playgroud)

问题是我总是收到这种错误信息

2014-12-09 16:51:08.219 XXXXX[1351:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/FDC7AA0A-4F61-47E7-955B-EE559ECC06A2/XXXXX.app> (loaded)' with name 'LoginViewController''
*** First throw call stack:
(0x2efcaf0b 0x39761ce7 0x2efcae4d 0x31b693f9 0x31ac1eaf 0x3191e365 0x317fe895 0x318a930d 0x318a9223 0x318a8801 0x318a8529 0x318a8299 0x318a8231 0x317fa305 0x3147631b 0x31471b3f 0x314719d1 0x314713e5 0x314711f7 0x3146af1d 0x2ef96039 0x2ef939c7 0x2ef93d13 0x2eefe769 0x2eefe54b 0x33e6b6d3 0x3185d891 0x4ccc8 0x4cd04 0x39c5fab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Run Code Online (Sandbox Code Playgroud)

uiviewcontroller uinavigationcontroller ios swift xcode6

66
推荐指数
8
解决办法
18万
查看次数

单击 tableview 中的 collectionview 单元格进行导航

我有一个 tableview 单元格,其中添加了 collectionview 单元格(用于水平滚动)。

现在我想在按下水平集合视图的任何单元格时推送到其他导航控制器。怎么做 ?或者我如何定义单元格按压的委托方法。

代码 :

ViewController.swift :

class ViewController: UIViewController {
    var categories = ["Action", "Drama", "Science Fiction", "Kids", "Horror"]
}

extension ViewController : UITableViewDelegate { }

extension ViewController : UITableViewDataSource {

    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return categories[section]
    }

    func numberOfSections(in tableView: UITableView) -> Int {
        return categories.count
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> …
Run Code Online (Sandbox Code Playgroud)

uitableview ios uicollectionview swift

2
推荐指数
1
解决办法
3125
查看次数