2013-09-25 55 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;