【问题标题】:PFImageView not showing up in the windowPFImageView 未显示在窗口中
【发布时间】:2015-06-25 12:52:57
【问题描述】:

我正在尝试使用 snapchat 克隆进行解析,一切正常,但是当我必须为用户显示图像时,PFImageView 没有显示,我不知道因为没有错误显示只是没有子视图。

违规部分:

func checkForMessages() {

if PFUser.currentUser()?.username != nil {

    println("checking for msgs")

    var query = PFQuery(className: "Image")
    query.whereKey("recipientUsername", equalTo: PFUser.currentUser()!.username!)

    var msgs = query.findObjects()

    println("\(msgs?.count) \(PFUser.currentUser()!.username!) recipientUsername")

    var done  = false

    if let msg = msgs as? [PFObject] {
        for msgReceived in msg {

            if done == false {

                var imageView: PFImageView = PFImageView()

                imageView.file = msgReceived["image"] as? PFFile

                imageView.loadInBackground({

                    (photo, error) -> Void in


                    if error == nil {

                        var displayedImage = UIImageView(frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height))

                        displayedImage.image = photo

                        println(photo!.description)

                        self.view.addSubview(imageView) //here it should place it in the view
                    }
                })


                done = true
            }

        }

    }

    println(msgs?.count)
} else {

    println("waiting for user this should be not showing")
}
}

【问题讨论】:

    标签: ios swift parse-platform xcode6


    【解决方案1】:

    检查您的 Supporting Files/ParseStarterProject-Bridging-Header.h 文件,看看它是否缺少以下行:

    #import <ParseUI/ParseUI.h>
    

    如果有,请务必添加。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-29
      • 1970-01-01
      • 2022-12-23
      • 2015-08-28
      相关资源
      最近更新 更多