【发布时间】:2012-05-15 10:38:45
【问题描述】:
我试图通过使用层,使用此代码仅显示 UIStepper 控件的一部分
UIStepper *testStepper = [[UIStepper alloc]init];
[testStepper setFrame:CGRectMake(120, 220, 94, 27)];
testStepper.maximumValue = 5;
testStepper.minimumValue = 1;
testStepper.value = 1;
testStepper.layer.cornerRadius =3;
testStepper.layer.bounds= CGRectMake(0, 0, 47, 27);
testStepper.layer.masksToBounds=YES;
testStepper.layer.opacity = 1;
[self.view addSubview:testStepper];
但它并不完全有效。 UIStepper 现在只显示我想要的 UIStepper 的左侧(减号),但是当我按下减号的右侧时,它仍然添加一个值,当我按下左侧时它减去(我也想要左侧的东西)。 我做错了什么?
谢谢
【问题讨论】:
-
为什么不用一个UIButton和一个标签,在action方法中处理最大值?
标签: objective-c xcode calayer uistepper