I'm trying to add a UIView to each side of a cube like the one in this pic:
http://upload.wikimedia.org/wikipedia/commons/0/02/Face_colored_cube.png
Since UIViews are rectangular shaped it's difficult to achieve what I'm trying. All I do by now is to rotate views but it isn't enough.
What's the correct way to achieve that? Any ideas?
Thanks in advance.
You need to do a perspective view transformation.
Have a look at this tutorial
You can also look at this answer by Brad Larson
Related
As you can understand from the title of this question I am trying to achieve fill animation of CALayer(CAShapeLayer) of SVG file.
How complex should be animation you can see from the images I attached.
I decided to start just with a circle and animate it to fill a layer below. Everything works pretty well.
So, I started building UIBezierPath or something like that but it looks like I am going the wrong direction.
I would really appreciate if you can just give me different ideas how to achieve it.
For SVG I use SVGKit. Maybe by using these set of classes, I can do something.
Thank you!
I'm trying to create something like this:
I looked many resources for that, but I still don't have idea how can I do it. Using CoreAnimation, Quartz2d or UIBezierPath I can draw a circle, but how can I draw a nice diagram with touch gesture's aid, using that? Maybe I wrong searched? If any tutorial, or sample code for this issue?
Best and easy library I used to draw pie chart with animation; MIM Chart Library for iOS
https://github.com/ReetuRaj/MIMChart-Library
Open source.
OK, CoreAnimation is not what you're looking for with this.
Anyway...
If you want to make a nice Pie Chart then you should take a look at CorePlot.
It has a lot of graphing functions and pie charts are in there too.
You can still animate with this you just need to update the percentages based on touch. Don't try to animate the sections of the circle. Change the percentages and update the circle.
Looks like you are trying to do some charts & plotting. If that is so, there is something called as
Core Plot
ILGraphics
OVGraphView
Some controls as well
Hope that helps.
I'm really interested in creating a UIScrollView similar to the Yahoo Weather app. Here's an example on video:
http://www.youtube.com/watch?v=a-q_yetkpik
I have found this Git which will alow me to do the fade background thing:
https://github.com/justinmfischer/core-background
But how would I achieve the blur effect at the top so that as content scrolls up, it almost fades out behind the UINavigationBar
Any help would be appreciated!!
I wrote the code for the UI effects in the Yahoo! Weather app, would be happy to answer your question.
Sounds like you've figured out how to do the blur (fade between a blurred image based on pixel offset, maxing out at a certain amount... for even better effect, you can have multiple steps in the blur - i.e. fade between non-blurred to half-blurred, then half-blurred to full-blurred etc).
For the fading under kind of effect, you can set the mask property on your content view's layer:
https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instp/CALayer/mask
The mask is an image that fades from transparent to opaque.
--Iain.
I am probably a little late for the party but I have an example project that does exactly that. I did try to look through Yahoo! app for the said image mask Iain was talking about. I have yet to be able to use it the way he described. So I created a CALayer on the fly to achieve the effect.
(#Iain, awesome job! big fan)
Here is the GitHub link
I haven't personally tried it but this might be a good start: https://github.com/kronik/DKLiveBlur
DKLiveBlur
Sources of DKLiveBlur and Demo app to show live blur effect similar to yahoo weather iOS app.
I achieved a similar effect using FXBlurView:
https://github.com/nicklockwood/FXBlurView
You simply set the blurRadius relative to the amount scrolled: scrollView.contentOffset.y
Thanks to Iain for pointing out CALayer masks.
Download the sample code for blur from Evan Davis blog.
I got an UIView with 4 views in the corners which will be dragged to create a perspective effect. This is how it looks like in the beggining:
Once the user drags a view, it will create a transform effect. For example:
I investigated it and I figured out I have to use CALayer to do that, but I'm still no clearer on how to create this kind of transform on an iPhone. Any help, pointers or example code snippets would be really appreciated!
Thanks!
You should search for CATransform3D. But this is kind of a good start.
When I am working with uiimageview, I want to rotate it with a small angle, and I did. But, in the border of uiimageview after rotating appears spikes, like a saw. I do not know why and try to fix it but I cant. Please help me.
Couple of options..
1) If you are using Core Graphics functions to rotate you can enable anti alias options
CGContextSetAllowsAntialiasing(context, true);
CGContextSetShouldAntialias(context, true);
2) Add a 1 pixel transparent border to the your image on all 4 sides.
One more thing, there is a technical term to the spikes you saw and it is aliasing. And the techniques to prevent aliasing are called anti aliasing techniques. Hope this helps.
Thanks all you guys :) My friend showed me another way to fix it. I think this way is better than using transparent border trick. He changed an attribute in info plist file, that is "Renders with edge antialisasing", to YES. And everything becomes okay :). I hope it will help someone get a same prob with me :)
Take a UIView as subView and Place UIImageView on subView.
Keep the size of subView and UIImageView Same.
Now, Use "UIViewAnimationTransitionFlipFromRight" or "UIViewAnimationTransitionFlipFromLeft" with Timer.
What you can do easily is to add a 1px transparent border around your image. So if your image is, let's say, 50x50 pixels you need to make it 52x52 such that the outer pixels are transparent. When you will rotate it should look fine now.