How do I achieve Yahoo Weather ScrollView Effect? - ios

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.

Related

How to do animation using autolayout in ease in ease out fashion for all screen sizes of iOS?

Using autolayout how can I do animation like ease in, ease out. Should I switch to core-animation for this.
For animation using constraints I understood from this link How do I animate constraint changes?
But they are not talking about animating like this.
How would I do animation like this, or in a bezier path using bezier function which would look good in all iOS sizes of screens . I searched a lot but I am missing this answer for a long time. A standard practise of doing ease in ease out or along a bezier path using autolayout . I understand there is a workaround but again asking for the standard practise?

Center-aligned masked UIImageView / Imitating Twitter & Facebook app's image views

Post title can be a little bit weird but here's what I'm looking forward to do:
Look at the image in the middle, it's displaying only a part of the original image. It's still high definition, not really cropped but only masked with the center of the image at the center of the view.
So basically they put a bigger image behind a smaller view (I did that for having circular imageviews in the past). But how can I achieve that particularly?
Is there any cocoapods or something to do so or should I get started doing it myself? Any suggestions on how to code-wisely build this?
The main goal here is to keep a static space to display images so they're always the same width/height. Doing this effect seems like a good way of achieving this.
EDIT: Here's a little sketch of an idea I just had to mimic that behavior:
Thanks a lot and have a nice day.
If you're asking what I think you're asking, you don't have to look far to find this functionality. Use UIView's built in contentMode property, specifically in this case, UIViewContentModeScaleAspectFill.
[imageView setContentMode:UIViewContentModeScaleAspectFill];
Then to crop of the parts of the image extending out of the frame, be sure to use clipsToBounds:
[imageView setClipsToBounds:YES];
Here is another solution, but make sure your image width and height is greater than the imageview,
imageView.contentMode=UIViewContentModeCenter;
imageView.clipsToBounds=YES;
imageView.clearsContextBeforeDrawing=NO;

Circular White Pinch Gesture Overlay commonly used for Blurring Images in iOS

I have implemented the ability to blur images in my iOS app using the pinch gesture, however I would like to implement a circular white overlay that is commonly used as a reference point with the pinch gesture so that the user can adjust the amount of blur. Just like the image below:
The image above was from: https://media.tumblr.com/tumblr_lutwauVUW31qm4rc3.png
How can I implement this feature?
Thanks!
GaussianSelectiveBlurFilter in GPUImage lib may be help yo a lot. well,here is the github source.
I think it is not hard to use, hope you will enjoy it.
You can use a GPUImageVignetteFilter, and set the vignette color to white.
I'm guessing you're implementing the blur with GPUImageGaussianSelectiveBlurFilter within GPUImage (because I see you tagged GPUImage in your question). If you are, you'll notice that the properties on GPUImageGaussianSelectiveBlurFilter don't exactly translate over to GPUImageVignetteFilter, so you'll have to do a bit of math to translate to a new "coordinate" system, but it's fairly trivial.

Prob when rotating an uiimageview

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.

Blackberry glossy tabbar

I have a tab bar in my application, however I'm trying to attain a glossy effect like the one featured in the Rhapsody Blackberry app or the Flixster Blackberry app. I've thought about using a PNG, but I'm sure theres a better way to do it programmatically like using a gradient. Any help would be much appreciated!
Flixster app
http://news.cnet.com/i/bto/20091106/Flixter_Curve.png
Rhapsody app (I would prefer to have it look like this)
http://nexus404.com/Blog/wp-content/uploads2/2010/12/blackberry-for-rhapsody-300.jpg
Thanks!
it is indeed possible.
Create a 1 pixelx40pixel (height as much as you want) png image of a gradient which is glossy so we get the glossy effect.
in paint() call graphics.tileRop() passing in Graphics.ROP_SRC_COPY as the Constant for the raster operation to execute.
This will draw the gradient to the extent of the region you set to.
The best way is use PNG for that. If you try to paint gradient programmatically be ready to see non-smooth gradient with visible color lines.

Resources