我在另一个view
上制作了view
并从右到左制作了一张可移动的label
表单,问题是label
在整个view
上移动了我想仅在第二个view
上显示它而不是在主视图上..如何隐藏label
来自特定view
?
这是我的代码
- (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);
}];
}
三江源。
答案 0 :(得分:3)
如果 self.move 是标签,则将其超级视图的 clipsToBounds 属性设置为是
即
self.move.superview.clipsToBounds = YES;
如果self.move超出其超级视图范围,它将剪辑。
希望有所帮助:)
答案 1 :(得分:0)
隐藏UILabel
使用: -
yourLbl.hidden = YES;
[yourLbl setHidden:YES];
或删除
[yourLbl removeFromSuperview];
希望它可以帮助你。