自定义一个UIButton放在导航条的titleView上面
UIButton的位置在正中央,但是UIButton的label却在靠右,点击UIButton的时候又显示在正中央,小白求大神解答,跪谢!!
试试这个
UIView * view = [[UIView alloc] init]; view.frame = button.bounds; [view addSubview:button]; self.navigationItem.titleView = view;
[button sizeToFit];
self.navigationItem.titleView = button;