草庐IT

initWithCustomView

全部标签

iOS 7 UIButtonBarItem 图像不着色

在我的导航栏上,我有几个具有自定义图标的rightBarButtonItems(图标图像是白色的,这与iOS6的基本配色方案配合得很好)。在iOS7下,使用initWithTitle加载图像(参见代码片段1)将图标中的“白色”颜色替换为适当的全局色调(在本例中为特定的深蓝色)代码片段1:UIBarButtonItem*refreshButton=[[UIBarButtonItemalloc]initWithTitle:@""style:(UIBarButtonItemStyle)UIBarButtonSystemItemCanceltarget:(self)action:@select

iphone - 使用 initWithCustomView 创建的 UIBarButtonItem 不会触发操作

我正在更新一些旧代码,为了在工具栏中腾出更多空间,我正在将按钮从测试转换为图像。loadView中新旧代码的一个例子是这样的://Newcode,doesn'twork.UIButton*toggleKeyboardBtn=[UIButtonbuttonWithType:UIButtonTypeCustom];toggleKeyboardBtn.bounds=CGRectMake(0,0,showKeyboardImage.size.width,showKeyboardImage.size.height);[toggleKeyboardBtnsetImage:showKeyboardI