the code is:Class ViewController: UIViewController{ @IBAction func playButton(sender: UIButton){ imageView1.animationImages=[UIImage(named:”pad”)] }@IBOutlet weak var imageView1:UIImageView!
Post
Replies
Boosts
Views
Activity
Thank you so much🙂
thanks a lot🙂
I'm afraid, my key question is just the same as the last answer in "https://stackoverflow.com/questions/55316223/how-to-explain-completionhandlertrue"
I just begin to learn swift. Where can I find "The header doc of `UIContextualActionHandler` (in UIContextualAction.h)"
Thanks a lot🙂
Thanks a lot
Actually, the reason that makes me to focus on "scale" is about "gesture recognizer handler".@objc func adjustFaceCardScale(byHandlingGestureRecognizerBy recognizer: UIPinchGestureRecognizer){ switch recognizer.state { case .changed,.ended: faceCardScale *= recognizer.scale recognizer.scale = 1.0 default: break } }If I get rid of "recognizer.scale = 1.0". The image size of faceCard will change rapidly, not as expected. How it works?
"line 05" is the key to the problem. The image size of faceCard will change exactly as expected, getting larger or smaller gradually according to pinching. However, without "line 05", the image size change drastically, just something like "exponential" effect. How to interpret it?
thanks a lot
I get it, thank you very much.
Thank you. It works.
I drag a image.jpg into the assets.xcassets.
Then you have added an Image Set of name image to the Asset catalogue, not Data Set.
You may need to use UIImage.init(named:).
Or else if you want to use NSDataAsset, you need to add a Data Set
It works for me. I make a new data set, and drag the image into it. Thanks a lot. The only flaw is that it would not to provide "1x、2x、3x" options for resources like image set. :(
BTW, is "UIImage(named:)" the only way to retrieve image data from image set in assets catalog? Are there other feasible methods, like by url, Data-like object, or ...? UIImage is a bit expensive for sizing and to resizing.
I'm writing a little app which will present some HD images. I need to keep the memory from spiking up. I fall back on ImageIO which needs images' data or url as input parameters.
If choose "url", I have not yet found a way to get urls of images in assets catalog. I don't want to put images in main bundle directly either. Therefore, it seems like I have to choose to retrieve images' data.
I try to use UIImage.jpegData(compressionQuality: ) and NSDataSet.data both. Final result is NSDataSet could save 10mb memory per image than UIImage.
The return value must conform to Shape. It's a fundamental requirement by function signature, isn't it?
NO.
The reason is?