簡體   English   中英

檢查UIImageView是否正在設置動畫

[英]Checking if UIImageView is animating

我目前正在開發允許用戶選擇個人資料圖片的應用程序。

我可以選擇圖像並將其顯示在iPhone屏幕上。 我想確保用戶在保存所有信息之前已選擇圖像。 我已經進行了一些研究,發現isAnimating()函數可用於檢查UIImageView是否實際上是“動畫” /“顯示”用戶的圖像。 不幸的是,當我做支票時

        if profileImage.isAnimating() == true{

             self.user.save()
            self.performSegueWithIdentifier("moveToMainScreen", sender: self)
        } else {
            println("please select an image")
            println(profileImage.isAnimating())
        }

即使profileImage正在顯示... isAnimating()始終返回false。 :(

我不確定此功能是否存在問題或是否需要做其他事情。

任何幫助將不勝感激。 :(

您使用了錯誤的方法。 當UIImageView動畫時,isAnimating返回YES。 UIImageView允許您在一組UIImages之間進行動畫處理

有關更多詳細信息,請參閱文檔

我認為您將要使用image屬性。 如果為零,則未設置任何圖像。

    if profileImage.image { // nil evaluates to false
        self.user.save()
        self.performSegueWithIdentifier("moveToMainScreen", sender: self)
    } else {
        println("please select an image")
        // println(profileImage.isAnimating())
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM