navigationItem标题以及左右button的创建...


创建TableView的navigationItem的Text  左右Button

- (void)customizeNavigationBarContent
{
    //titleView
    UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
    labelTitle.text = @"添加联系人";
    labelTitle.textColor = [UIColor whiteColor];
    labelTitle.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = labelTitle;
    RELEASE_SAFE(labelTitle);
    //leftBar
    UIBarButtonItem *barLeft = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"clsose"] style:(UIBarButtonItemStylePlain) target:self action:@selector(handleBack:)];
    self.navigationItem.leftBarButtonItem = barLeft;
    RELEASE_SAFE(barLeft);
    //rightBar
    UIBarButtonItem *barRight = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"doneR"] style:(UIBarButtonItemStylePlain) target:self action:@selector(handleSave:)];
    self.navigationItem.rightBarButtonItem = barRight;
    RELEASE_SAFE(barRight);
}

你可能感兴趣的:(button,左右)