在iOS-NSException上实例化视图在动画图像数组时捕获

时间:2016-01-22 11:47:24

标签: ios nsarray

Ken View是IBOutlet JBKenView * kenView的名称 我把它连接到UIView

-(void)viewDidLoad
{

[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor=[UIColor whiteColor];
// NSArray *collage = [NSArray arrayWithObjects:[UIImage imageNamed:@"collage1.jpg"],[UIImage imageNamed:@"collage 2.png"],[UIImage imageNamed:@"collage 3.png"],nil];
self->kenView.layer.borderWidth = 1;
self->kenView.layer.borderColor = [UIColor blackColor].CGColor;


//img.animationImages=collage;
// img.animationDuration=8.0;
//img.animationRepeatCount=0;
//[img startAnimating];
btn.backgroundColor=[UIColor colorWithRed:100.0/255 green:260.0/255 blue:183.0/255 alpha:1.0];
UIDatePicker *datePicker = [[UIDatePicker alloc]init];
[datePicker setDate:[NSDate date]];
[datePicker addTarget:self action:@selector(updateTextField:) forControlEvents:UIControlEventValueChanged];
[text2 setInputView:datePicker];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
                               initWithTarget:self
                               action:@selector(dismissKeyboard)];

[self.view addGestureRecognizer:tap];
UIDatePicker *picker = (UIDatePicker*)text2.inputView;

picker.datePickerMode=UIDatePickerModeDate;

}

-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSArray *myImages = @[[UIImage imageNamed:@"collage1.jpg"],
                      [UIImage imageNamed:@"collage2.png"],
                      [UIImage imageNamed:@"collage3.png"],];



[kenView animateWithImages:myImages
        transitionDuration:6
              initialDelay:0
                      loop:YES
               isLandscape:YES];

}

实现此操作会出错:

2016-01-22 17:11:10.022 alumini2[29528:1325602] -[UIView setDelegate:]: unrecognized selector sent to instance 0x7f8c31f2c700
2016-01-22 17:11:10.026 alumini2[29528:1325602] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setDelegate:]: unrecognized selector sent to instance 0x7f8c31f2c700'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107c22885 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010769bdf1 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000107c2ab5d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x0000000107b77e3a ___forwarding___ + 970
    4   CoreFoundation                      0x0000000107b779e8 _CF_forwarding_prep_0 + 120
    5   alumini2                            0x0000000106d413c2 -[FirstViewController viewDidLoad] + 706
    6   UIKit                               0x000000010814bd65 -[UIViewController loadViewIfRequired] + 860
    7   UIKit                               0x000000010814c0b4 -[UIViewController view] + 27
    8   UIKit                               0x000000010802f3d4 -[UIWindow addRootViewControllerViewIfPossible] + 61
    9   UIKit                               0x000000010802fad1 -[UIWindow _setHidden:forced:] + 302
    10  UIKit                               0x0000000108040ff8 -[UIWindow makeKeyAndVisible] + 43
    11  UIKit                               0x0000000107fc302b -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3545
    12  UIKit                               0x0000000107fc8ef0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
    13  UIKit                               0x0000000107fc673f -[UIApplication workspaceDidEndTransaction:] + 188
    14  FrontBoardServices                  0x000000010cda8d7b FrontBoardServices + 163195
    15  FrontBoardServices                  0x000000010cda9118 FrontBoardServices + 164120
    16  CoreFoundation                      0x0000000107b4d0f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    17  CoreFoundation                      0x0000000107b42eac __CFRunLoopDoSources0 + 556
    18  CoreFoundation                      0x0000000107b42363 __CFRunLoopRun + 867
    19  CoreFoundation                      0x0000000107b41d78 CFRunLoopRunSpecific + 488
    20  UIKit                               0x0000000107fc6091 -[UIApplication _run] + 402
    21  UIKit                               0x0000000107fca79b UIApplicationMain + 171
    22  alumini2                            0x0000000106d4481f main + 111
    23  libdyld.dylib                       0x00000001095efa05 libdyld.dylib + 10757
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)  

0 个答案:

没有答案