我的UIViewController
QuoteViewController
有一个UITableView
。 UITableView
内部是名为UITableViewCell
的自定义excessTableViewCell
。
在故事板中,我创建了一个自定义的tableview单元格,并将自定义类分配给excessTableViewCell
,我已将滑块IBAction
与ValideDidChange
这是 excessTableViewCell.m 的样子。
#import "ExcessTableViewCell.h"
@implementation ExcessTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.excessLabel.text = [NSString stringWithFormat:@"$ %@", self.excessString];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
- (IBAction)excessValueChanged:(UISlider *)sender
{
UISlider *MySlider = (UISlider *)sender;
int SliderValue = (int)(MySlider.value/10) * 10;
self.excessLabel.text = [NSString stringWithFormat:@"$ %d", SliderValue];
}
@end
这就是我的行的QuoteViewController
tableview单元格。
// slider
NSString *cellIDString = @"excessCell1";
self.excessTableViewCell = [tableView dequeueReusableCellWithIdentifier:cellIDString forIndexPath:indexPath];
// Configure the cell...
self.excessTableViewCell.excessSlider.maximumValue = 2000;
self.excessTableViewCell.excessSlider.value = 2000 / 2;
NSInteger halfValue = 2000 / 2;
self.excessTableViewCell.excessLabel.text = [NSString stringWithFormat:@"$ %ld", (long)halfValue];
return self.excessTableViewCell;
有效的是,当我尝试滑动该值时,应用程序崩溃并产生以下错误。
这就是我的错误:
2017-04-08 17:12:08.863831 Insuriato[17401:3848405]
-[QuoteViewController sliderValueChanged:]: unrecognized selector sent to instance 0x1005423f0 2017-04-08 17:18:57.449734 Insuriato[17401:3848405] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[QuoteViewController sliderValueChanged:]: unrecognized selector sent to instance 0x1005423f0'
*** First throw call stack: (0x1860f51b8 0x184b2c55c 0x1860fc268 0x1860f9270 0x185ff280c 0x18bfdfd30 0x18bfdfcb0 0x18bfca128 0x18c387758 0x18bfe7974 0x18c56a628 0x18c5666c0 0x18c5661e0 0x18c56549c 0x18bfda30c 0x18bfaada0 0x18c79475c 0x18c78e130 0x1860a2b5c 0x1860a24a4 0x1860a00a4 0x185fce2b8 0x187a82198 0x18c0157fc 0x18c010534 0x100087a3c 0x184fb15b8) libc++abi.dylib: terminating with uncaught exception of type NSException