0

I have defined segmentControl buttons.

@property(nonatomic, strong) SegmentControl *option;
SegmentControl *result = [[SegmentControl alloc] initWithFrame:frame items:@[@"Bad", @"Good"]];


result:self.option.selectedSegmentIndex

why am I getting this error: property 'selectedSegmentIndex' not found on object of type 'segmentControl',

@class SegmentControl;
@protocol SegmentControlDelegate <NSObject>
@optional
- (void)segmentControl:(SegmentControl *)segmentControl didSelectSegment:(UIButton *)segment;

@end

@interface SegmentControl : UIView

@property(nonatomic, assign) BOOL staySelected;
@property(nonatomic, weak) id<SegmentControlDelegate> delegate;

- (id)initWithFrame:(CGRect)frame items:(NSArray *)items;

@end
4

1 に答える 1

0

クラスSegmentControlは、UISegmentControlのサブクラスである必要があります(UIViewではありません)。

于 2013-02-26T22:43:41.690 に答える