UIButton *releaseButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [releaseButton setTitle:@"发布" forState:normal]; [releaseButton addTarget:self action:@selector(releaseInfo:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *releaseButtonItem = [[UIBarButtonItem alloc] initWithCustomView:releaseButton]; self.navigationItem.rightBarButtonItem = releaseButtonItem;
原文:http://www.cnblogs.com/SimonGao/p/5105667.html