我正在尝试在C4Stepper上使用我自己的图像。我正在设置它
@implementation C4WorkSpace{
C4Stepper *theStepper;
C4Image *stepperBackground;
C4Image *stepperPlus;
}
-(void)setup {
//load backgroundimage
stepperBackground=[C4Image imageNamed:@"icon_zoom.png"];
stepperBackground.width=100;
//load incrementImage
stepperPlus=[C4Image imageNamed:@"icon_zoom_plus.png"];
stepperPlus.width=stepperBackground.width/2;
//setup stepper
theStepper=[C4Stepper stepper];
[theStepper setBackgroundImage:stepperBackground forState:NORMAL];
[theStepper setIncrementImage:stepperPlus forState:NORMAL];
theStepper.center=self.canvas.center;
[self.canvas addSubview:theStepper];
}
这两个图标如下所示: 奇怪的是,画布上显示的内容如下所示:! zoomStepperImages有什么特殊要求吗?一定的尺寸或什么?
答案 0 :(得分:2)
有特殊要求。
C4Stepper
中看到如何初始化C4AppDelegate.m
类的默认值:...
[C4Stepper defaultStyle].style = basicStyle;
[C4Stepper defaultStyle].tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"lightGrayPattern"]];
[[C4Stepper defaultStyle] setDecrementImage:[C4Image imageNamed:@"decrementDisabled"] forState:DISABLED];
[[C4Stepper defaultStyle] setDecrementImage:[C4Image imageNamed:@"decrementNormal"] forState:NORMAL];
[[C4Stepper defaultStyle] setIncrementImage:[C4Image imageNamed:@"incrementDisabled"] forState:DISABLED];
[[C4Stepper defaultStyle] setIncrementImage:[C4Image imageNamed:@"incrementNormal"] forState:NORMAL];
就像一张纸条,当我创建C4Button
课程时,我不得不玩弄我正在制作的各种图像,让它们“看起来”正确......最后,我不得不做了很多调整和实验,以了解它们是如何渲染的。我弄清楚这个问题的难点在于UIButton
本身的渲染机制有点奇怪,我必须学习如何将东西放入按钮中以便正确渲染。