0

我正在尝试设置 Parse PFLoginViewController 出现。这是我的一个视图控制器的课程。

import UIKit

import Parse
import ParseUI

class FirstViewController: PFLogInViewController, UITableViewDataSource, UITableViewDelegate,  PFLogInViewControllerDelegate {

    @IBOutlet weak var tableView: UITableView!

    var textArray:NSMutableArray! = NSMutableArray()

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.


    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {


        return self.textArray.count
    }


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

        var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell


        cell.textLabel?.text = self.textArray.objectAtIndex(indexPath.row) as? String

        return cell
    }
}

我不明白的是,为什么在我运行应用程序时会出现 PFLoginViewController?我没有做设置代码来让它出现,所以我很困惑它为什么会出现。

我的猜测是,我的 viewController 不知何故被自动替换为 PFLogInViewController ,因为我将它包含在顶部?

我的项目是一个 Swift 应用程序。

4

1 回答 1

1

FirstViewController PFLogInViewController(一个子类)。如果FirstViewControllerrootViewController您的应用程序窗口的 ,或者如果它是容器视图控制器的第一个/根视图控制器本身就是窗口的rootViewController,那么您将PFLogInViewController在运行应用程序时看到 。

当你在 Swift 中定义一个类时,冒号后面的第一个类型是该类的超类(或者,如果冒号后面的第一个类型是协议,那么你的类是一个不继承自超类的根类)。

于 2015-08-06T15:43:18.653 回答