0
我有應用程序我希望導航欄上的按鈕應該在所需的位置,但它沒有完成我已經找到了rightBarButton和leftBarButton的方法,但我想要在導航欄的中心添加到導航欄到所需的位置
UIButton *settingsView = [[UIButton alloc] initWithFrame:CGRectMake(0,0,40,40)];
[settingsView addTarget:self action:@selector(SettingsClicked) forControlEvents:UIControlEventTouchUpInside];
[settingsView setBackgroundImage:[UIImage imageNamed:@"login btn.png"] forState:UIControlStateNormal];
UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithCustomView:settingsView];
[self.navigationItem setRightBarButtonItem:settingsButton];