Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

theprizerevealed

macrumors regular
Original poster
Feb 26, 2016
183
12
I want to make an app with a very simple animation. There will be a static picture and every time a new question is asked the picture will slide to the right a few millimeters or at most a centimeter. How can I do that programmatically? thanks
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
There are various ways to do this. To move a view you want to change its constraints, or more likely you want to change the constant on one or more of the view's constraints. To animate that movement you want to wrap the change to the constraint constant in an animation block.

Code:
UIView.animate(withDuration: 0.2) {
     imageViewLeadingConstraint.constant = newValue
}
 
  • Like
Reactions: deadworlds

theprizerevealed

macrumors regular
Original poster
Feb 26, 2016
183
12
Okay, thank you. Actually I need some suggestions for a good drawing software. I need to create some simple geometric shapes that can be colored differently. I tried the free version of autocad Sketchbook - it seems nice but it requires some adjusting to the tools. There's a bit of a learning curve to it. I wonder if anyone knows of any other graphics software that creates geometric shapes quickly and intuitively.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.