我正在编写一个iPad应用程序,其标签带有渐变图像背景。这已经在4.2中工作,但它不再工作。每次我试着跑,我得到一个SIGABRT,无论我是4.2还是4.3。我将把违规代码放在下面,我将不胜感激任何帮助。谢谢。
LabelSingAvg = [[UILabel alloc] initWithFrame:CGRectMake(70, -300, 200, 800)];
LabelSingAvg.text = @"99.8";
LabelSingAvg.font = [UIFont systemFontOfSize:90];
UIImage *myGradient = [UIImage imageNamed:@"textGradient.png"];
//Line that causes SIGABRT below:
LabelSingAvg.textColor = [UIColor colorWithPatternImage:myGradient];
LabelSingAvg.backgroundColor = [UIColor clearColor];
LabelSingAvg.textAlignment = UITextAlignmentCenter;
LabelSingAvg.adjustsFontSizeToFitWidth = YES;
LabelSingAvg.layer.shadowOpacity = .5;
LabelSingAvg.layer.shadowRadius = 4.0;
LabelSingAvg.layer.shadowColor = [UIColor blackColor].CGColor;
LabelSingAvg.layer.shadowOffset = CGSizeMake(1.0, 1.0);
//LabelSingAvg.alpha = 0.8;
[self.view addSubview:LabelSingAvg];
答案 0 :(得分:0)
没关系,我明白了。谢谢你的帮助。我引用的图像已移出我的资源文件夹。