2015-03-03 47 views
-2
// 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]; 
+2

? – 2015-03-03 07:28:28

+1

爲什麼在使用之前釋放?並設置左鍵兩次將取代。所以一個按鈕在使用之前會被銷燬...... – Wain 2015-03-03 07:36:31

回答

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]; 
相關問題