我在表视图方面遇到问题,选择一个将我发送到Web视图的单元格,但是在代码处却没有,我是开发应用程序ios的新手。谢谢

var arr: [String]?
    var index : Int = Int()

override func viewDidLoad() {
    super.viewDidLoad()

    arr = ["google","yahoo","Swift"]
    // Do any additional setup after loading the view, typically from a nib.
}


override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
            return 1
        }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return arr!.count
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        //var identifier : NSString = "Cell"

        let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath ) as UITableViewCell


这个问题符合

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
            return arr!.count
        }


这是控制台消息:


  tableView UITableView 0x00007fc504033a00 0x00007fc504033a00部分Int 0 0 self OtraPrueba.ViewController 0x00007fc503548ca0 0x00007fc503548ca0 UIKit.UITableViewController UITableViewController 0x0000000105a4b3d0 0x000000010‌5a4b3d0 arr 3个值某些[0]字符串“ google” [1]字符串“ yahoo” [2]字符串“ Swift”索引Int 0 0

最佳答案

您确定它崩溃了吗?
您的控制台将显示变量说明,并且不会显示错误消息。
您已经在代码中放置了断点,它可能不会崩溃。删除(或禁用)断点后,尝试运行。

关于ios - 快速将tableview转换为webview,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29333953/

10-10 23:30
查看更多