Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios MarqueeLabel不工作,它只是在屏幕上显示为UILabel_Ios_Iphone - Fatal编程技术网

Ios MarqueeLabel不工作,它只是在屏幕上显示为UILabel

Ios MarqueeLabel不工作,它只是在屏幕上显示为UILabel,ios,iphone,Ios,Iphone,我已将链接中的文件包括在我的项目中 MarqueeLabel *continuousLabel2 = [[MarqueeLabel alloc] initWithFrame:CGRectMake(10, 440, self.view.frame.size.width-20, 20) rate:10 andFadeLength:10.0f]; continuousLabel2.tag = 101; continuousLabel2.marqueeType = MLContinuous; cont

我已将链接中的文件包括在我的项目中

MarqueeLabel *continuousLabel2 = [[MarqueeLabel alloc] initWithFrame:CGRectMake(10, 440, self.view.frame.size.width-20, 20) rate:10 andFadeLength:10.0f]; 
continuousLabel2.tag = 101;
continuousLabel2.marqueeType = MLContinuous;
continuousLabel2.animationCurve = UIViewAnimationOptionCurveLinear;
continuousLabel2.continuousMarqueeExtraBuffer = 50.0f; 
continuousLabel2.numberOfLines = 1; 
continuousLabel2.opaque = YES; 
continuousLabel2.enabled = YES; 
continuousLabel2.textAlignment = NSTextAlignmentLeft; 
continuousLabel2.textColor = [UIColor colorWithRed:0.234 green:0.234 blue:0.234 alpha:1.000]; 
continuousLabel2.backgroundColor = [UIColor clearColor]; 
continuousLabel2.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.000]; 
continuousLabel2.text = @"This is another long label that scrolls continuously with a custom space between labels! You can also tap it to pause and unpause it!"
[self.view addSubview :continuousLabel2];

我已经在我的项目中粘贴了上面的代码,但是文本只是显示为UILabel,而不是marquee。请告知

将此置于代码末尾

 [continuousLabel2 restartLabel];

[self performSelector:@selector(startlabel) withObject:nil afterDelay:1.0];
-(void)startlabel{
        [continuousLabel2 restartLabel];
}

我使用
resetLabel
启动字幕动画

另外,不要忘记将
labelize
属性设置为
NO
。i、 e

[self.marqueeLabel resetLabel];
self.marqueeLabel.labelize= NO;

由Github提供的字幕标签文档 “MarqueeLabel尽最大努力在适当的时候自动开始滚动,但有时视图/视图控制器在屏幕上的显示方式可能会使其出错。 使用restartLabel实例方法“手动”开始在MarqueeLabel上滚动


[yourMarqueeLabel restartLabel]

你在你的项目中导入了Quartzcore框架吗?是的,它已经导入了。好的,我测试了代码,它适合我。。我想您可能需要更改连续标签的宽度。。试着缩小它,看看这是否会产生影响。试着缩小宽度,但仍然得到相同的结果。此解决方案正在运行。谢谢你能解释一下我的代码有什么问题吗