(iOS开发)导航栏navigationBar中间添加按钮

navigation bar 中间title变成button:
 UIButton * button =[UIButton buttonWithType:UIButtonTypeCustom];
 button.frame=CGRectMake(20, 20, 100, 40);
 [button setTitle:@"1/3" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(showAllQuestions:) forControlEvents:UIControlEventTouchUpInside];

    self.navigationItem.titleView =button;


你可能感兴趣的:(iOS开发)