I need help with adding a lottie animationView to a UIButton,
something like this -
just ignore the hebrew text
I need the icon on the right here to be a lottie animation view.. Can't figure it out, don't know if it's at all possible, can someone try to help here?
I need the icon on the right here to be a lottie animation view..
First off, welcome to Stackoverflow.
Secondly, this shouldn't be that hard. Since the goal is to simply make the icon as a lottie animation view, you can either:
Subclass the UIButton - in this way you can put the animation view on top of the imageView of the button.
Add directly a lottie animation view on top of the button.
Personally, I think the first one should do the job and is actually a better method.
Related
I try to make animation of open uicollectionview (like the video in the link), Someone have idea how to code it?
https://imgur.com/D1V18oW
This link is example of how I won't the effect look.
Ok, I succeed by anime with UIView.animate the UICollectionViewCell.layer.position attribute.
I'm trying to add login button overlap on subview, the touch event for uibutton does not work on lower-half.
Can anyone provide me an idea to achieve design like this, with touch event work on all corner ?
You view set up should look something like:
As Inderjeet mentioned in his comment, "You have to keep button outside the UIView otherwise it is not tap-able. Maintain the position of button according to UIView by using constraints."
Now to answer why, set clip to bounds property of your view to true. You will see, on run time, portion which is not tap-able, is also not visible.
How would I create a custom search bar that looks like this:
I could also use a textfield if that would be easier. How would I create a text field that looks like this using Swift?
Create your customTextField class and inherit it from UITextField.
Make its edges round setting cornerRadius for its layer and color it gray the same way.
Add a UIImageView with on top of the search bar.
Accept touches on the view. On touchesBegan, make the textField becomeFirstResponder and make the image hidden to true.
If you want to make a custom textfield or search bar you are going to have to do it programatically. You can add the search bar or textfield to the view but in order to get a customized look, like the one in the picture below. Also, make sure that you have all the code in the ViewDidLoad() and create an outlet for the item on the view. It isn't hard to do and I'm sure you will get the desired outcome as long as you are willing to go through some trial and error!
Don't worry doing all the customization is a bunch of fun, and give a great feeling after you have solved it!
I hope this helps
So I'm trying to do exactly this:
http://blog.typpz.com/2013/12/09/ios-sdk-create-a-pop-up-window/
But since I am not using SpriteKit i can't use this exact method.
I imagine that there should be a way to create this same pop up window effect using sprite builders layer option maybe? Then animating it using some of the CCAction methods that exist. Im not sure though and don't really know how to go about figuring out.
Any help is appreciated.
A simple way to do this would be to create a CCLayer, as you said, and animate it.
Once you've created a CCLayer to the size of the "popup" you want, and then added whatever you want to put in it, you can then start animating it.
If you want to get a similar effect to the animation in the tutorial you linked, the best way would be to use a combination of CCActionFadeIn and CCActionScaleTo. Conveniently, Spritebuilder's animation set has both of these for use, and you can easily set up an keyframe animation from within Spritebuilder without too much code. (Make sure to name the animation sequence to something you can easily remember since you'll need to refer back to it when you start coding - I'd call it "PopupAnimation", or something like that.)
Once you've finished doing that, all you have to do is call the animation from your code. For example, if I have a CCButton whose selector is "showPopup", I would do:
func showPopup() {
self.animationManager.runAnimationsForSequenceNamed("PopupAnimation")
}
Assuming you've done everything right, the popup will now appear! But now you're stuck with the popup on the screen, and with no way out.
To fix this, make another animation sequence (I'll call this "RemovePopup") which will remove the popup from the screen. Add a button to your CCLayer, and set its selector to "hidePopup". From your code, you can then run:
func hidePopup() {
self.animationManager.runAnimationsForSequenceNamed("RemovePopup")
}
And now you have a "popup" window that you can animate!
Hey guys I added a UIImageView to the subview and want to remove it after a couple of seconds.
self.view.addSubview(car)
Now I want to remove the image completely. I tried something like:
self.view.delete(car)
But than I get a really long error when I press the button, which should remove the image.
I hope you can help me out.
-Lukas
removeFromSuperview is your way to go.
car.removeFromSuperview()
Methods to manage the view hierarchy are documented for UIView.