[UIBarButtonItem setNavigationBar:]:无法识别的选择器发送到实例&由于未捕获的异常'NSInvalidArgumentException而终止应用程序

时间:2015-03-03 07:26:13

标签: ios objective-c iphone

   // Close
    UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:[[I18n sharedInstance] cancelButton]
                                                                    style:UIBarButtonSystemItemCancel
                                                                   target:self
                                                                   action:@selector(dismissSignatureView:)];
    [self.navigationItem setLeftBarButtonItem:closeButton];
    [closeButton release];


    // Close Button
    UIBarButtonItem *eraseButton = [[UIBarButtonItem alloc] initWithTitle:@"Clear"
                                                                    style:UIBarButtonItemStyleBordered
                                                                   target:self
                                                              action:@selector(eraseSignature:)];

    [self.navigationItem setLeftBarButtonItem:eraseButton];
    [eraseButton release];

    // Close and Save
    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:[[I18n sharedInstance] okButton]
                                                                   style:UIBarButtonItemStyleBordered
                                                                  target:self
                                                                  action:@selector(dismissSignatureViewAndSelect:)];
    doneButton.tag = fieldTag;

    [self.navigationItem setRightBarButtonItem:doneButton];
    [doneButton release];

    [self.signatureSheet.navigationBarView setItems:[NSArray arrayWithObjects:closeButton, eraseButton, doneButton, nil]];

    [self.signatureSheet viewWillAppear:NO];

1 个答案:

答案 0 :(得分:0)

// Close
    UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:[[I18n sharedInstance] cancelButton]
                                                                    style:UIBarButtonSystemItemCancel
                                                                   target:self
                                                                   action:@selector(dismissSignatureView:)];
    [self.navigationItem setLeftBarButtonItem:closeButton];



    // Close Button
    UIBarButtonItem *eraseButton = [[UIBarButtonItem alloc] initWithTitle:@"Clear"
                                                                    style:UIBarButtonItemStyleBordered
                                                                   target:self
                                                              action:@selector(eraseSignature:)];

    [self.navigationItem setLeftBarButtonItem:eraseButton];


    // Close and Save
    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:[[I18n sharedInstance] okButton]
                                                                   style:UIBarButtonItemStyleBordered
                                                                  target:self
                                                                  action:@selector(dismissSignatureViewAndSelect:)];
    doneButton.tag = fieldTag;

    [self.navigationItem setRightBarButtonItem:doneButton];


    [self.signatureSheet.navigationBarView setItems:[NSArray arrayWithObjects:closeButton, eraseButton, doneButton, nil]];

    [self.signatureSheet viewWillAppear:NO];