导航条上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;

 

posted on 2013-07-24 10:52  jack_yan  阅读(1976)  评论(0编辑  收藏  举报