我收到以下错误:
- (UIView *)carousel:(iCarousel *)carousel placeholderViewAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
UILabel *label = nil;
//create new view if no view is available for recycling
if (view == nil)
{
view = [[UIImageView alloc] init];
label = [[UILabel alloc] initWithFrame:view.bounds];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
label.font = [label.font fontWithSize:50.0f];
[view addSubview:label];
}
else
{
label = [[view subviews] lastObject];
}
//set label
label.text = (index == 0)? @"[": @"]";
return view;
}
-[SocialCatalogViewController carousel:placeholderViewAtIndex:]: unrecognized selector sent to instance 0x1296db80
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SocialCatalogViewController carousel:placeholderViewAtIndex:]: unrecognized selector sent to instance 0x1296db80'
*** First throw call stack:
(0x2f3c052 0x30cdd0a 0x2f3dced 0x2f3e083 0x2ea30c9 0x2ea2ce2 0x2f1b25 0x2f1e6c 0x2f25b3 0x2f5863 0x2f1a44 0x2f2a50 0x2edd77 0x352e4b 0x143664e 0x1436941 0x144847d 0x144866f 0x144893b 0x14493df 0x1449986 0x14495a4 0x2e01b9 0x2ea1d4 0x2f3dec9 0x13735c2 0x137355a 0x1418b76 0x141903f 0x14182fe 0x1631a2a 0x2f109ce 0x2ea7670 0x2e734f6 0x2e72db4 0x2e72ccb 0x3349879 0x334993e 0x1370a9b 0x2e06 0x2d75 0x1)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
任何想法?
最佳答案
嗯,是。该错误表明您正在传递两个参数(用于carousel
和placeholderViewAtIndex
)。但是,该方法实际上是carousel: placeholderViewAtIndex: reusingView:
,即采用三个参数。因此,只需为reusingView
(或nil
)再传递一个,因为该方法具有处理这种情况的逻辑。
关于iphone - 无法识别的选择器已发出,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8949478/