在 UIToolbar 上的 iOS 应用程序中,我添加了带有图像的“完成”自定义按钮。
UIBarButtonItem *btnNextDoneDisable;
UIToolbar *navigateQuestionBar;
//*to add button
UIImage *img_done = [UIImage imageNamed:DONE_RED_BTN_PNG(appDelegate.isIphone)];
btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:img_done forState:UIControlStateNormal];
btn.frame = CGRectMake(0.0, 0.0, img_done.size.width, img_done.size.height);
[btn addTarget:self action:@selector(doneClicked) forControlEvents:UIControlEventTouchUpInside];
btnNextDoneDisable = [[UIBarButtonItem alloc] initWithCustomView:btn];
[arrButtons addObject:btnNextDoneDisable];
navigateQuestionBar.items = arrButtons;
完成按钮图像大小为:
80 × 30
156 × 57
按钮的合适尺寸是多少?