2013-09-25 52 views
0

我正在制作一个应用程序,我必须添加财富或旋转轮。后R & D我发现这Raywenderlich示例代码Rotating Wheel旋转/财富轮

它工作正常。但我必须根据我的应用程序要求更改一些旋转车轮用户界面。需要12个部分。为此,我在这里更改了部分12的数量

SMRotaryWheel *wheel = [[SMRotaryWheel alloc] initWithFrame:CGRectMake(0, 0, 200, 200) 
                andDelegate:self 
                withSections:12]; 

这是我需要添加的旋转轮的UI。 Rotating UI

在给出的示例代码中,当轮子停止时,选择区域位于此箭头的get选择下。 enter image description here

现在我想改变选择区域根据我的车轮用户界面在右侧。但我无法在给定示例中找到该代码。请帮助我如果有人对此有所了解。

在此先感谢。

+9

你要求我们阅读网络上的一些教程中的代码,并将其固定到您的要求? – Abizern

+3

嘿,Abizerm ..我问你是否有一个想法..可能是有一段时间你有这个问题的经验。如果你不......那么没有人强迫你给出答案或阅读教程。 @Abizern –

回答

3

您可以为此添加新的属性。

@interface SMRotaryWheel : UIControl 
//... 
@property (nonatomic, assign) float selectionAngle; 
//... 
@end 

@implementation SMRotaryWheel 
//... 

- (void)setSelectionAngle:(float)selectionAngle 
{ 
    _selectionAngle = selectionAngle; 
    UIImageView *im = [self getCloveByValue:currentValue]; 
    im.alpha = minAlphavalue; 
    [self endTrackingWithTouch:nil withEvent:nil]; 
} 
- (void)endTrackingWithTouch:(UITouch*)touch withEvent:(UIEvent*)event 
{ 
    CGFloat radians = atan2f(container.transform.b, container.transform.a) - _selectionAngle * M_PI/180; 
//... 
} 
//.. 

及用途:whell.selectionAngle = 90.0;