Reputation: 403
I have made a view
on another view
and make a movable label
form right to left, problem is that label
moves on whole view
and i want to show it only on second view
not on mainview.. how to hide that label
from particular view
??
here is my code
- (void)viewDidLoad {
[super viewDidLoad];
self.movelabel = [[UILabel alloc]initWithFrame:CGRectMake(200, 0, 200, 30)];
self.movelabel.text = @"This is my music line";
[self.moveview addSubview:self.move];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(LabelAnimation) userInfo:nil repeats:YES];
}
-(void)LabelAnimation
{
[UIView animateWithDuration:3.0f delay:0.0f options:UIViewAnimationOptionTransitionNone animations:^{
self.move.frame = CGRectMake(-200, 0, 200, 60);
} completion:^(BOOL finished)
{
self.move.frame = CGRectMake(200, 0, 200, 60);
}];
}
Thankyou.
Upvotes: 0
Views: 201
Reputation: 745
to hide UILabel
use :-
yourLbl.hidden = YES;
[yourLbl setHidden:YES];
or to remove
[yourLbl removeFromSuperview];
hope it may help you.
Upvotes: 0
Reputation: 1158
If self.move is label then set clipsToBounds property of its superview to yes
i.e
self.move.superview.clipsToBounds = YES;
It will clip if self.move goes out of bounds of its superview.
Hope it helps :)
Upvotes: 3