所以在我的主窗口中我有这两个按钮“设置”(leftBarButtonItem)和“i”(信息按钮,rightBarButtonItem)”
当我按下信息按钮时,我得到“免费”后退按钮,但我必须以编程方式为设置按钮创建一个?这是为什么?
这是我在 viewDidLoad 中对按钮进行编程的方式
UIBarButtonItem *settingsBarButtonItem =[[UIBarButtonItem alloc]initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:self action:@selector(settings:)];
self.navigationItem.leftBarButtonItem = settingsBarButtonItem;
UIButton* infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
CGRect frame = infoButton.frame;
frame.size.width = 40.0f;
infoButton.frame = frame;
[infoButton addTarget:self action:@selector(about:) forControlEvents:UIControlEventTouchUpInside];
butInfo = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
self.navigationItem.rightBarButtonItem = butInfo;