iOS - How do you show animations in part of a UIView? - ios

Alfred for iPhone has a cute, animated silver platter character that wiggles his mustache and does other things.
There's one sprite for the motionless character. Various animations are started as the user interacts with the app.
Assuming that they're using a UIView for the app, how is this done? Lots of animated GIFs? SVG animations? Cocos2D in a canvas or something? Lots of images and setting the UIImageView source?

I haven't seen this app.
Could possibly be UIImageView and the animationImages property
#property(nonatomic, copy) NSArray *animationImages
An array of UIImage objects to use for an animation.
It could be Quartz and Core Animation.
It could be Open GL ES.

Related

Is there an equivalent class to UIView in WatchKit?

I have an iOS app that dynamically draw shapes on UIView (through drawRect), and I am looking at the possibility to port that app (or a small part of that) to Apple Watch. Unfortunately, after read through relative posts I cannot find which class can handle the similar job in WatchKit.
So the question is:
If there is a similar class like UIView, in WatchKit, to draw lines cycles on Apple Watch?
What is the best (possible) way to implement a simple drawing function on Apple Watch, if there is no UIView like class. (Assume this is achievable)
Thanks in advance.
No, there is no class similar to UIView in WatchKit
You can generate images and transfer them to Watch App using WKInterfaceImage's func setImage(image: UIImage?)
If you already have drawing code for drawing in -drawRect:, it shouldn't be that difficult to modify it to support drawing to image

Is it possible to create marker with animated icon?

I'm using Google Maps SDK for iOS and I would like to display a marker on my map. I've found out that the class GMSMarker is involved but it only accepts UIImage icon.
I would like the icon to be UIView or CALayer such that its contents could be animated. Is this possible?
I know that if needed, both of the aforementioned UI objects can be rendered into UIImage. However, that's utterly unefficient and ugly code. I would be really happy if there was other way.
Thanks in advance,
Pete.
No, the marker (or overlay) can only display UIImage objects, although they do support animated UIImages (see the AnimatedCurrentLocationViewController in the demo project).

Creating an Initial tutorial for game inside my app

I have several iOS puzzle apps, written with Objective-C using QuartzCore.
I would like to include a quick animation showing how to solve the puzzle. Non interactive is OK.What would be a small format to use? Gif-anim? I would like to use minimal coding (pretty much just a 'do not show again' UIButton) and have the entire thing done with graphics file/s. Anyone has any suggestions? Maybe using web-kit?Thanks!!
What I ended up doing is following the suggestion of Mahal.
I created a view with a simple background image, and four buttons: Back, Close, Next slide and Previous slide.
At the start, you can choose to see tutorial. Otherwise, it's available from the help screen.Sharing flowchart below...
What about a UIImageView and an array of PNGs?
UIImageView
#property(nonatomic, copy) NSArray *animationImages
#property(nonatomic) NSTimeInterval animationDuration

how to take a UIView screenshot faster?

I'm making a dictionary app, which allows user find a word definition by touch the word in screen, and there will be a magnifier on screen and follow user's finger. I have implement it by take a screenshot of view and assign the image to maginifer image view, which is a UIImageView, however, in order to take a screenshot, the method [self.layer renderInContext:c]; cost too much time, is there any other way to do it ?maybe openGL will help?
after profiling my app with instruments->core animation, it is only 9 fps showing magnifier, but it will 30 fps if showing the system default magnifier in a UITextView, I don't know why the system is so fast
You can use exact same view in magnifier view, and change position to visible words.
There are new methods in iOS 7 that are highly optimized :
– snapshotViewAfterScreenUpdates:
– resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:
– drawViewHierarchyInRect:afterScreenUpdates:
However they are not available in previous versions.

Strange bug in iOS 7 UIImage (not showing or showing after delay)

Every time when we add UIImageView or simple UIView with some custom CALayer objects added to "layer" property to view hierarchy, there are some different scenarios:
1) all images (in uiimageviews and calayer) are drawn with random delay
2) some images are drawn, but some not, when we perform a simple touch event anywhere - they appear
3) some images are not drawn and they won't appear after simple touch events, the only way make them to appear is to minimize the app and to expand it again.
The last case appears much less than two others. That problem occurs only on iOS7, iOS 4.3-6.1 is totally OK. We have viewed a lot of possible solutions but they were pretty primitive and none of those helped.
Any help would be appreciated! Thanks in advance!
we solved the problem. For everyone, who has the same problem, - all you need is to create CALayer and UIImageView objects on main thread, while UIImage objects still could be created in background thread. All these fixes are needed only in iOS 7

Resources