Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 崩溃选项卡视图数据源可以';t链接数据源_Ios_Uitableview_Swift_Datasource - Fatal编程技术网

Ios 崩溃选项卡视图数据源可以';t链接数据源

Ios 崩溃选项卡视图数据源可以';t链接数据源,ios,uitableview,swift,datasource,Ios,Uitableview,Swift,Datasource,我的问题是关于这个问题的后续问题: 那个问题的人用了我需要的东西!我只是在不同的环境下尝试,无法正常工作 情况解释如下: 我有一个包含4个视图的屏幕构建: 背景和一些文本 具有集合视图的大视图容器 放置在集合视图上的小视图(alpha底部栏) 选项卡视图(下拉动画控制) 所有主要控件都位于第一个(背景)视图控制器中,这里还有一个打开相机应用程序的按钮 我在代码中遇到的错误如下: tableView:numberOfRowsInSection:]: unrecognized selector

我的问题是关于这个问题的后续问题: 那个问题的人用了我需要的东西!我只是在不同的环境下尝试,无法正常工作

情况解释如下:

我有一个包含4个视图的屏幕构建:

  • 背景和一些文本
  • 具有集合视图的大视图容器
  • 放置在集合视图上的小视图(alpha底部栏)
  • 选项卡视图(下拉动画控制)
所有主要控件都位于第一个(背景)视图控制器中,这里还有一个打开相机应用程序的按钮

我在代码中遇到的错误如下:

tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7ff13b039a70
而导致应用程序崩溃的是:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7ff13b039a70'
我不知道如何解决这个问题,或者这是否可行 代码如下所示,我使用的是上一篇文章中的DataSource类(重要部分如下)

以及加载数据源的位置:

   override func viewDidLoad() {
    super.viewDidLoad()
    var myColor : UIColor = UIColor( red: 0, green: 0, blue:0, alpha: 1.0 )

    let screenSize: CGRect = UIScreen.mainScreen().bounds
    bottom_bar.frame = CGRectMake(0
        ,screenSize.height  - bottom_bar.frame.size.height
        ,bottom_bar.frame.size.width
        ,bottom_bar.frame.size.height);
    collectionView.bringSubviewToFront(bottom_bar)
    checkButtonOutlet.layer.cornerRadius = 24
    checkButtonOutlet.layer.borderColor =   myColor.CGColor
    checkButtonOutlet.layer.borderWidth = 1
    amountLabel.layer.cornerRadius = 15

    amountLabel.layer.masksToBounds = true
    var dataSource: TableDataSource = TableDataSource(items: ["One", "Two", "Three"], cellIdentifier: "Cell")
    dropdownView.dataSource = dataSource
}
以及我打开相机应用程序的位置:

@IBAction func pictureCheck(sender: AnyObject) {
    if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
        println("Button capture")

        var imag = UIImagePickerController()
        imag.delegate = self
        imag.sourceType = UIImagePickerControllerSourceType.Camera;
        imag.mediaTypes = [kUTTypeImage]
        imag.allowsEditing = false

        self.presentViewController(imag, animated: true, completion: nil)
    }

}

您的问题似乎与所引用问题的评论中讨论并解决的问题完全相同。这是同一问题的一部分。问题是我无法将其连接到数据源。这意味着您的意思是将其连接为数据源:dropdownView.datasource=datasourceit连接正确,datasouce对象被释放,因为它不属于任何对象,然后某个字典占用了它的地址,因此tableview将其消息定向到此随机字典。
@IBAction func pictureCheck(sender: AnyObject) {
    if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
        println("Button capture")

        var imag = UIImagePickerController()
        imag.delegate = self
        imag.sourceType = UIImagePickerControllerSourceType.Camera;
        imag.mediaTypes = [kUTTypeImage]
        imag.allowsEditing = false

        self.presentViewController(imag, animated: true, completion: nil)
    }

}