Reputation: 819
how i can move a subview in a UIView to out of UIView frame, and see that value of outside in bottom! sorry please see my picture for understand, i dont want to use scrollview, and dont use duplicate views to do this.
thanks
Upvotes: 2
Views: 1215
Reputation: 1479
You have to duplicate the subview. There's no other way, because you can't add the same subview twice.
If you try to add an existing subview to another view, it will be automatically removed from it's superview.
After the view is duplicated, you can animate both of them in the way you described.
Upvotes: 2
Reputation: 20541
UPDATE
Here create same two subview , after that set frame both like bellow...
- (void)viewDidLoad
{
yourSubview1.frame = CGRectMake(yourSubview1.frame.origin.x, 200, yourSubview1.frame.size.width, yourSubview1.frame.size.height);
yourSubview2.frame = CGRectMake(yourSubview2.frame.origin.x, 400, yourSubview2.frame.size.width, yourSubview2.frame.size.height);
}
and after when you want to move subview at that time just call bellow code ...
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
yourSubview1.frame = CGRectMake(yourSubview1.frame.origin.x, yourSubview1.frame.origin.y - 100, yourSubview1.frame.size.width, yourSubview1.frame.size.height);
yourSubview2.frame = CGRectMake(yourSubview2.frame.origin.x, yourSubview2.frame.origin.y - 100, yourSubview2.frame.size.width, yourSubview2.frame.size.height);
//// set `y` where you want to display just like i minus the y with 100 so its move above with 100 point of y
[UIView commitAnimations];
This is just an example you can set this with your frame and timer ..
i hope this help you....
Upvotes: 0