我一直在四处寻找,还没有想出太多。说有一个预期的标识符错误。这是唯一的错误。任何帮助将不胜感激。
我只是有点困惑,我不确定是不是因为我一直在看太久,所以它一直给我解析错误。
这是我的.h
#import <UIKit/UIKit.h>
#import "AMRotaryProtocol.h"
@interface AMRotaryWheel : UIControl
-(void)drawWheel;
@property (weak) id <AMRotaryProtocol> delegate;
@property (nonatomic, strong) UIView *container;
@property int numberOfSections;
- (id) initWithFrame:(CGRect)frame andDelegate:(id)del withSections:(int)sectionsNumber;
@end
和.m
#import <QuartzCore/QuartzCore.h>
#import "AMRotaryWheel.h"
@interface AMRotaryWheel()
- (void) drawWheel
{
// 1
container = [[UIView alloc] initWithFrame:self.frame];
// 2
CGFloat angleSize = 2*M_PI/numberOfSections;
// 3
for (int i = 0; i < numberOfSections; i++) {
// 4
UILabel *im = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
im.backgroundColor = [UIColor redColor];
im.text = [NSString stringWithFormat:@"%i", i];
im.layer.anchorPoint = CGPointMake(1.0f, 0.5f);
// 5
im.layer.position = CGPointMake(container.bounds.size.width/2.0,
container.bounds.size.height/2.0);
im.transform = CGAffineTransformMakeRotation(angleSize * i);
im.tag = i;
// 6
[container addSubview:im];
}
// 7
container.userInteractionEnabled = NO;
[self addSubview:container];
}
@end
@implementation AMRotaryWheel
@synthesize delegate, container, numberOfSections;
- (id) initWithFrame:(CGRect)frame andDelegate:(id)del withSections:(int)sectionsNumber {
// 1 - Call super init
if ((self = [super initWithFrame:frame])) {
// 2 - Set properties
self.numberOfSections = sectionsNumber;
self.delegate = del;
// 3 - Draw wheel
[self drawWheel];
}
return self;
}
- (void) drawWheel {
}
@end
谢谢大家的帮助。