我有一个用于相机的自定义叠加层,我有UISlider叠加层:
@implementation LWOverlayView
- (id)initWithFrame:(CGRect)frame imagePath:(NSString*) imagepath{
if ((self = [super initWithFrame:frame])) {
// Clear the background of the overlay:
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
UIImageView *overlayGraphicView = [[UIImageView alloc] init];
overlayGraphicView.contentMode = UIViewContentModeScaleAspectFill;
[overlayGraphicView setImageWithURL:[NSURL URLWithString:imagepath]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
overlayGraphicView.frame = CGRectMake(80, 140, 160, 120);
[self addSubview:overlayGraphicView];
UIToolbar *toolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 436, 320, 44)];
[toolbar setBarStyle:UIBarStyleBlackOpaque];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismiss)];
CGRect frame = CGRectMake(0.0, 0.0, 200.0, 10.0);
UISlider *slider = [[UISlider alloc] initWithFrame:frame];
[slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
[slider setBackgroundColor:[UIColor clearColor]];
slider.minimumValue = 0.0;
slider.maximumValue = 50.0;
slider.continuous = YES;
slider.value = 25.0;
[toolbar setItems:[NSArray arrayWithObjects:doneButton, slider, nil]];
[self addSubview:toolbar];
}
return self;
}
应用程序崩溃:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISlider view]: unrecognized selector sent to instance 0x20854fe0'
有什么提示吗?