我创建了一个应用程序,它从主视图控制器加载另一个视图控制器。从视图控制器 1 到视图控制器 2 的示例......在视图控制器 1 中,如果按下按钮,它需要加载视图控制器 2。在视图控制器 2 中我也有 icarousel 视图。这是我的代码
-(IBAction)showcoll:(id)sender{
CollectionsViewController *sec=[[CollectionsViewController alloc]initWithNibName:Nil bundle:Nil];
sec.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
NSLog(@"hi");
[self presentModalViewController:sec animated:YES];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect splashFrame =splash.frame;
splashFrame.origin.x = self.view.bounds.size.width;
[UIView animateWithDuration:3
delay:1.0
options: UIViewAnimationCurveEaseOut
animations:^{
splash.frame = splashFrame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
[self.view addSubview: splash];
}
我遇到的问题是
2012-06-30 11:16:29.301 Minora[948:12203] Done!
2012-06-30 11:16:31.195 Minora[948:12203] hi
2012-06-30 11:16:31.198 Minora[948:12203] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x6e82b70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dataSource.'
*** Call stack at first throw:
(
0 CoreFoundation 0x013e45a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02b97313 objc_exception_throw + 44
2 CoreFoundation 0x013e44e1 -[NSException raise] + 17
3 Foundation 0x00b3b677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x00b3b5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x003eeff6 -[UIView(CALayerDelegate) setValue:forKey:] + 173
6 UIKit 0x005b730c -[UIRuntimeOutletConnection connect] + 112
7 CoreFoundation 0x0135a8cf -[NSArray makeObjectsPerformSelector:] + 239
8 UIKit 0x005b5d23 -[UINib instantiateWithOwner:options:] + 1041
9 UIKit 0x005b7ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
10 UIKit 0x0046d628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
11 UIKit 0x0046b134 -[UIViewController loadView] + 120
12 UIKit 0x0046b00e -[UIViewController view] + 56
13 UIKit 0x0046ca3d -[UIViewController viewControllerForRotation] + 63
14 UIKit 0x00468988 -[UIViewController _visibleView] + 90
15 UIKit 0x0070a93c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
16 UIKit 0x003e281e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
17 UIKit 0x0066a619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
18 UIKit 0x0046f65d -[UIViewController presentModalViewController:withTransition:] + 3478
19 Minora 0x0000317a -[ViewController showcoll:] + 218
20 UIKit 0x003bb4fd -[UIApplication sendAction:to:from:forEvent:] + 119
21 UIKit 0x0044b799 -[UIControl sendAction:to:forEvent:] + 67
22 UIKit 0x0044dc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
23 UIKit 0x0044c7d8 -[UIControl touchesEnded:withEvent:] + 458
24 UIKit 0x003dfded -[UIWindow _sendTouchesForEvent:] + 567
25 UIKit 0x003c0c37 -[UIApplication sendEvent:] + 447
26 UIKit 0x003c5f2e _UIApplicationHandleEvent + 7576
27 GraphicsServices 0x01539992 PurpleEventCallback + 1550
28 CoreFoundation 0x013c5944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
29 CoreFoundation 0x01325cf7 __CFRunLoopDoSource1 + 215
30 CoreFoundation 0x01322f83 __CFRunLoopRun + 979
31 CoreFoundation 0x01322840 CFRunLoopRunSpecific + 208
32 CoreFoundation 0x01322761 CFRunLoopRunInMode + 97
33 GraphicsServices 0x015381c4 GSEventRunModal + 217
34 GraphicsServices 0x01538289 GSEventRun + 115
35 UIKit 0x003c9c93 UIApplicationMain + 1160
36 Minora 0x00002ada main + 170
37 Minora 0x00002a25 start + 53
)
terminate called throwing an exception(lldb)