2011-04-07 137 views

回答

1
UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithTitle:@"title" style:UIBarButtonItemStylePlain target:self action:@selector(btnAction)]; 
    [self.navigationItem setRightBarButtonItem:rightBarButton]; 
    [rightBarButton release]; 
0

試試這個:

UIButton *btnPrev =[[UIButton alloc] init]; 
    [btnPrev setBackgroundImage:[UIImage imageNamed:@"btnPrevious.png"] forState:UIControlStateNormal]; 
    btnPrev.frame = CGRectMake(100, 100, 50, 30); 
    [btnPrev addTarget:self action:@selector(backButtonClicked) forControlEvents:UIControlEventTouchUpInside]; 


    UIBarButtonItem *btnBack =[[UIBarButtonItem alloc] initWithCustomView:btnPrev]; 
    self.navigationItem.leftBarButtonItem = btnBack;