I want to move one view to right when I clicked a button. I wrote something but it's not working;
UIView* view = [self.view viewWithTag:100];
if (!view) {
NSLog(@"nil");
}
[UIView animateWithDuration:0.3f
animations:^{
[view setTransform:CGAffineTransformMakeTranslation(-100, 0)];
}
completion:^(BOOL finished){
}
];
Do it like this .
leftFrame is the frame where you can start and right frame is where you want to move to
Happy Coding :)
try this code;
You can also move your view with smooth animation like this
and call it like this
for more you can also modify it to pass your require duration on function call like this.
there are other options like