导航条上UIBarButtonItem的更改方法(使用initWithCustomView:btn)

UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:self.newMenuViewController] autorelease];

            [self presentModalViewController:nav animated:YES];

            

            UIButton *newMenuBackBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];

            [newMenuBackBtn addTarget:self action:@selector(newMenuBackBtnTapped:) forControlEvents:UIControlEventTouchUpInside];

            newMenuBackBtn.frame = CGRectMake(0, 5, 54, 30);

            UIBarButtonItem *backItem = [[UIBarButtonItem alloc ] initWithCustomView:newMenuBackBtn];

            self.newMenuViewController.navigationItem.leftBarButtonItem = backItem;

 

你可能感兴趣的:(uibarbuttonitem)