Ios是否将标签(歌曲标题)从右侧移动到左侧?
如何移动标签? 我想显示一首歌的标题,从右边移动到左边,持续时间我可以设置。正如你在汽车收音机上看到的那样。当标签离开屏幕时,它应从右侧重新出现Ios是否将标签(歌曲标题)从右侧移动到左侧?,ios,uilabel,Ios,Uilabel,如何移动标签? 我想显示一首歌的标题,从右边移动到左边,持续时间我可以设置。正如你在汽车收音机上看到的那样。当标签离开屏幕时,它应从右侧重新出现 谢谢你Iphone没有为UILabels提供这样的功能,你需要为此设置标签动画 请参阅此链接 只需拖放MarqueeLabel.h和MarqueeLabel.m文件,并按如下方式创建标签: MarqueeLabel *rightLeftLabel = [[MarqueeLabel alloc] initWithFrame:CGRectMake(10,
谢谢你Iphone没有为UILabels提供这样的功能,你需要为此设置标签动画 请参阅此链接 只需拖放MarqueeLabel.h和MarqueeLabel.m文件,并按如下方式创建标签:
MarqueeLabel *rightLeftLabel = [[MarqueeLabel alloc] initWithFrame:CGRectMake(10, 260, self.view.frame.size.width-20, 20) rate:50.0f andFadeLength:10.0f];
rightLeftLabel.numberOfLines = 1;
rightLeftLabel.shadowOffset = CGSizeMake(0.0, -1.0);
rightLeftLabel.textAlignment = NSTextAlignmentRight;
rightLeftLabel.textColor = [UIColor colorWithRed:0.234 green:0.234 blue:0.234 alpha:1.000];
rightLeftLabel.backgroundColor = [UIColor clearColor];
rightLeftLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:17.000];
rightLeftLabel.marqueeType = MLRightLeft;
rightLeftLabel.text = @"This text is not as long, but still long enough to scroll, and scrolls the same speed but to the right first!";
[self.view addSubview:rightLeftLabel];
他们创建了UIView子类,并设置了UIView子视图的UILabel动画
希望这对您有所帮助:Iphone不为UILabels提供此类功能,您需要为其设置标签动画
UILabel *toastLabel = [[UILabel alloc]init*];
toastLabel.text = @"Our toast text";
[toastLabel setHidden:TRUE];
[toastLabel setAlpha:1.0];
CGPoint location;
location.x = 0;
location.y = 400;
toastLabel.center = location;
location.x = 500;
location.y = 400;
[toastLabel setHidden:FALSE];
[UIView animateWithDuration:8 animations:^{
toastLabel.alpha = 0.0;
toastLabel.center = location;
}];
请参阅此链接
只需拖放MarqueeLabel.h和MarqueeLabel.m文件,并按如下方式创建标签:
MarqueeLabel *rightLeftLabel = [[MarqueeLabel alloc] initWithFrame:CGRectMake(10, 260, self.view.frame.size.width-20, 20) rate:50.0f andFadeLength:10.0f];
rightLeftLabel.numberOfLines = 1;
rightLeftLabel.shadowOffset = CGSizeMake(0.0, -1.0);
rightLeftLabel.textAlignment = NSTextAlignmentRight;
rightLeftLabel.textColor = [UIColor colorWithRed:0.234 green:0.234 blue:0.234 alpha:1.000];
rightLeftLabel.backgroundColor = [UIColor clearColor];
rightLeftLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:17.000];
rightLeftLabel.marqueeType = MLRightLeft;
rightLeftLabel.text = @"This text is not as long, but still long enough to scroll, and scrolls the same speed but to the right first!";
[self.view addSubview:rightLeftLabel];
他们创建了UIView子类,并设置了UIView子视图的UILabel动画
希望这对您有所帮助:
UILabel *toastLabel = [[UILabel alloc]init*];
toastLabel.text = @"Our toast text";
[toastLabel setHidden:TRUE];
[toastLabel setAlpha:1.0];
CGPoint location;
location.x = 0;
location.y = 400;
toastLabel.center = location;
location.x = 500;
location.y = 400;
[toastLabel setHidden:FALSE];
[UIView animateWithDuration:8 animations:^{
toastLabel.alpha = 0.0;
toastLabel.center = location;
}];