Simple wipe animation for image view - objective-c

I've scoured the internet and I cannot seem to find any help on this. I want to have an image perform a wipe animation. By that I mean I would like the image itself to fade in from the left to right (not move from left to right, but fade, like reveal itself. I hope that's not a terrible description) I've found material on how to transition the image with a wipe, but it's outdated and I don't want to transition the image, I want to straight up fade it in. If anybody could help me on this I would be incredible grateful. Thank you so much, let me know if I can help clarify anything!

First thing that came to my mind is to have a separate UIImageView, with image something like this: http://www.creativecow.net/articles/ahearn_luke/creating_clouds/images/gradient.jpg (but transparent-to-white).
So - once You want to fade out Your image, You add as a subview a new UIImageView, which has frame like 3 times the width of the original image You want to hide. Once You add it as a subview, visually nothing would change, as the beginning of the hovering UIImageView would be transparent, But then You start animate frame (origin.x) of the hovering UIImageView so that it would be moved to the left side. While this happens, bottom ImageView will be gradually hidden from one side. After animation ends, You remove/hide both UIImageViews.
Not the best solution, but - if You are stuck, and still want the effect... Atleast some option.. Good luck!

Related

UIPanGesture ignore outside of of mask with CAShapeLayer

I ran into this problem, I have 27 UIView's laying on top of each other, with exactly the same frame, visually they are laying next to each other, visual respresentation:
So the frame for all of them is the big yellow square. They get masked using a CAShapeLayer (the colored triangles). I add a UIPanGesture to all of them (not sure this is the best way to do it), and I want to determine on which one the user panned. Of course (obviously), only the top one is accessible, and always is the view in the UIPanGesture. How do I determine on which one of the UIView's the finger was panning? A for loop seems expensive too.. Or am I approaching this wrong?
This is the code for creating all of them and handling the pan gesture:
Gist to code
Sender to tag is always 27 though, of course... No clue how to solve this one guys! Anyone a clue?
Figure it out!
I moved everything into a custom UIView, where in draw rect I draw all the triangles using CAShapeLayers, add a UIPanGesture to it self, and in the gesture handler you can check in a for loop with CGPathContainsPoint if that layer contains the gesture point!
Solution code snippet
Hope this helps someone!

Custom TabBarItem menu IOS 7

I'm trying to make an UITabBarController like this:
No matter the device width (whether it is rotated or not) the buttons should not be stretched and the leftover space should be on the right side.
My questions:
Is this possible with the UITabBarController?
For the whitelines inbetween the buttons I am planning to use an unclickable UITabBarItem with an image. Is this the best way to do this?
With this tutorial that I followed I am getting this result:
2 problems here ^, whilst my background.png is 320x49, the selected image (68x49) has padding. This should not happen, both pictures have the same height?
The second problem is that the button/image has trailing space, and I want it sticked to the left side, as in my first screenshot. How would I accomplish this?
I don't expect anyone to post code, just merely a push in the right direction as I'm totally lost on this.
Check this library, you can customize the UI in interface builder with consstraints and get what you want.

weird gap when using uiscrollview and uilabel

here is the problem i have a tow muti-line label with many content, so I use a scroll view to show them all
then I follow this to do the autolayout: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html#//apple_ref/doc/uid/TP40010853-CH5-SW2
basic idea is to make a container view outside the scroll view to make sure the labels can fill the scroll view no matter what direction it is.
here is the hierarchy and constraint:
and the portrait mode works well:
but when it change to landscape mode some wired gap pops up!
and the more text i put in the label the higher gap i got!
my question is what should i do to kill those gap?
please give me some explicit solution or just give me an example, thank you!
and i am using autolayout in ios7, so some solution without coding are preferred!

Irregular shaped buttons using OBShapedButton with hidden image

I am trying to make an irregular shaped button with the OBShapedButton class. That's ok, created it without any problem, however I need the image to be transparent. So, I just want an area from the image which will be clickable, but the image won't be seen.
I tried setting alphas on image, imageView and on the button itself, however it doesn't work neither way.
How should I do it?
Maybe it could be done by something else, not an UIButton, but unfortunately I didn't find anything on the net that I could understand and use.
Ok, so the easiest way on how to do this is:
Subclass UIButton and add touchesBegan, touchesEnded, touchesMoved,
touchesCancelled.
Then on touchesBegan, hide the image of the button and show the correct image in background.
And finally on touchesEnded or touchesMoved, show again the image of the button.
Hope it will help someone :)

Blue border appearing around NSScrollView

I'm sure this is normal and I'm just misunderstanding something, but since making one of my NSScrollViews slightly inset from the bottom of the window (as opposed to taking the full height), a blue border has appeared around it.
I've set NSNoBorder on the scroll view, so this must be something else.
[scrollView setBorderType:NSNoBorder];
Any pointers would be greatly appreciated. I'd like the border to go away as it spoils the look of the app and just looks broken.
I assume it's the scroll view. The view inside it as an NSOutlineView, so maybe it's something on that?
That's the focus ring. It shows which view is going to get the keystrokes if the user types anything. If you suppress it, then your app will not be in compliance with the UI guidelines.