iOS - Aufruf Selector auf den Button, der einen Parameter

Hallo, das ist hoffentlich eine einfache Frage, zu lösen.

Was ich bin versucht zu tun haben, ist ein Selektor, der auf eine button-Aktion, ruft meine andere Methode, mit der mit dem Namen von einem Film zu spielen. Wenn ich den Datei Namen zurück zu der Methode funktioniert es einwandfrei.

Was ich glaube, ich bin stolpern, ist der richtige Weg, um fügen Sie den Wahlschalter auf die Schaltfläche. Jede Eingabe /Ratschläge oder Empfehlungen wäre willkommen.

Vielen Dank im Voraus.

    //The Button
    infobuttonTwo           = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    infobuttonTwo.frame     = CGRectMake(405, 204, 49, 58);
    [infobuttonTwo addTarget:self 
                      action:@selector(buttonInfo:) withObject:@"VTS_02_1" 
            forControlEvents:UIControlEventTouchUpInside];



//The Method It's calling
-(void)buttonInfo:(NSString *) fileName {



//The Error it's showing.
-[UIRoundedRectButton addTarget:action:withObject:forControlEvents:]: unrecognized selector sent to instance 0x660e9e0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIRoundedRectButton addTarget:action:withObject:forControlEvents:]: unrecognized selector sent to instance 0x660e9e0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x011bfbe9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x013145c2 objc_exception_throw + 47
    2   CoreFoundation                      0x011c16fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x01131366 ___forwarding___ + 966
    4   CoreFoundation                      0x01130f22 _CF_forwarding_prep_0 + 50
    5   bCIT                                0x000054f3 -[TrailersViewController popButtons] + 647
    6   bCIT                                0x0000444b -[TrailersViewController right] + 437
    7   bCIT                                0x00003b2d -[TrailersViewController handleSwipeFrom:] + 191
    8   UIKit                               0x005559c7 -[UIGestureRecognizer _updateGestureWithEvent:] + 727
    9   UIKit                               0x005519d6 -[UIGestureRecognizer _delayedUpdateGesture] + 47
    10  UIKit                               0x00557fa5 _UIGestureRecognizerUpdateObserver + 584
    11  UIKit                               0x0055818a _UIGestureRecognizerUpdateGesturesFromSendEvent + 51
    12  UIKit                               0x002f36b4 -[UIWindow _sendGesturesForEvent:] + 1292
    13  UIKit                               0x002eef87 -[UIWindow sendEvent:] + 105
    14  UIKit                               0x002d237a -[UIApplication sendEvent:] + 447
    15  UIKit                               0x002d7732 _UIApplicationHandleEvent + 7576
    16  GraphicsServices                    0x01af5a36 PurpleEventCallback + 1550
    17  CoreFoundation                      0x011a1064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    18  CoreFoundation                      0x011016f7 __CFRunLoopDoSource1 + 215
    19  CoreFoundation                      0x010fe983 __CFRunLoopRun + 979
    20  CoreFoundation                      0x010fe240 CFRunLoopRunSpecific + 208
    21  CoreFoundation                      0x010fe161 CFRunLoopRunInMode + 97
    22  GraphicsServices                    0x01af4268 GSEventRunModal + 217
    23  GraphicsServices                    0x01af432d GSEventRun + 115
    24  UIKit                               0x002db42e UIApplicationMain + 1160
    25  bCIT                                0x000029b4 main + 102
    26  bCIT                                0x00002945 start + 53
)
terminate called after throwing an instance of 'NSException
InformationsquelleAutor Mytheral | 2011-03-23
Schreibe einen Kommentar