问题标签 [uibarbuttonitemstyle]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5505 浏览

iphone - 解释leftBarButtonItem、rightBarButtonItem、titleView的这个margin逻辑

谁能向我解释您在下面的屏幕截图中看到的边距来自哪里?我希望红色、绿色和蓝色矩形在屏幕布局、横向和纵向中都彼此相邻。相反,我在视图之间看到了莫名其妙的边距。

我用这段代码看到的:

在此处输入图像描述 在此处输入图像描述

真正让我感到困惑的是,随着可用空间变小,视图之间的边距变得越来越大?我不明白他们为什么在那里,也不明白为什么他们的行为与我对利润的期望背道而驰。

谢谢!

0 投票
2 回答
10925 浏览

iphone - 使用 UIBarButtonItemStyle 创建一个 UIBarButtonSystemItem

我想创建一个系统 UIBarButton,但我希望它具有简单的样式。
我已经尝试过使用此代码,但样式被忽略了。它出什么问题了?

0 投票
2 回答
1273 浏览

ios5 - UIBarButtonItemStyleDone 使用 iOS 5 外观 API 的背景图片

如何为具有 UIBarButtonItemStyleDone 样式和 Edit/Done 按钮的编辑状态的条形按钮提供视觉上不同的条形按钮项背景图像?UIBarButtonItem 外观代理的 setBackgroundImage:forState:barMetrics: 中记录的 UIControlState 值似乎都不起作用。

0 投票
2 回答
1682 浏览

iphone - 具有 UIBarButtonItemStyleDone 样式的导航栏上的 UIBarButtonItem 不显示为蓝色

我在导航栏上有一个完成按钮,我想让它显示为蓝色。但只是做以下似乎没有帮助。我在这里想念什么?我知道如果导航栏为黑色,按钮将自动显示为蓝色,但我不希望此视图控制器上导航栏的颜色为黑色。

0 投票
1 回答
2103 浏览

iphone - 将 UIBarButtonItem 的样式更改为 BarButtonSystemItem

我是 iPhone 开发的新手,所以我不确定这是否是一个非常普遍的问题。我在 Google 上没有找到任何关于此的内容。

我有一个使用 Interface Builder 定义的 UIBarButtonItem:

现在,它只是一个简单的按钮,但我想在上面放一个相机图像,使用UIBarButtonSystemItemCamera. 我知道可以用 来做到这一点initWithBarButtonSystemItem,但我没有像changeWithBarButtonSystemItem. 我想要类似的东西:

这怎么可能 ?有没有办法告诉 Interface Builder 直接用这个相机图标实例化按钮?


编辑

实例化后似乎无法更改按钮样式。所以只剩下一个问题:有没有办法告诉 Interface Builder 用 实例化一个按钮UIBarButtonSystemItemCamera

0 投票
1 回答
678 浏览

iphone - UIBarButtonItem image/glyph in Standard UIButton

I'm trying to create a 'Refresh' button containing the standard UIBarButton refresh system glyph, which, when tapped, will animate a custom view, then fire another selector to call the intended refresh action.

I know I could do this with images and two inner views added to a custom view, but is there any way to do it with the standard glyphs from UIBarButtonItem? Are they available at all for UIButtons?

0 投票
8 回答
41892 浏览

iphone - “导航项中不支持普通样式”警告我的自定义条形按钮项

我将圆形矩形按钮拖动到右侧条形按钮项的位置,并将图像设置为圆形矩形按钮。一切正常,除了警告“导航项中不支持普通样式”。即使我将 Bar Button Item 的样式选择为“Bordered”,警告仍然存在。Xcode 4.2 有什么问题?提前致谢!

附言。我使用圆形矩形按钮自定义了许多条形按钮项,有时 Xcode 4.2 在条形按钮项上仅显示一个警告,有时在所有条形按钮项上显示警告。

0 投票
1 回答
4231 浏览

iphone - 无法将 UIBarbutton 设置回默认色调

如果我更改 UIBarbutton 的色调,如何将其重置为默认色调。

在这里,我为按钮设置了自定义色调...

然后稍后我需要将其设置回它的默认样式和色调。所以我认为只需将样式设置为 UIBarButtonItemStyleDone 就可以做到这样......

但颜色仍然是红色。我可以自己将其设置为漂亮的蓝色,但我想获得 UIBarButtonItemStyleDone 按钮的默认颜色。这可能吗?

谢谢,约翰

0 投票
2 回答
6972 浏览

ios5 - UIBarButtonItem 外观 setTitleTextAttributes 不影响 UIControlStateDisabled 状态

我们的设计师要求我为禁用的 UIBarButtonItems 的文本使用特定颜色。我用来实现这个的代码:

但它不会改变文本属性。

我已经尝试过使用正常状态的代码,尝试使用 setBackgroundImage 更改 UIControlStateDisabled 按钮的背景,并且所有 thouse 实验都运行良好。但是这个单一的组合:setTitleTextAttributes 和 UIControlStateDisabled 并没有做任何事情。

谷歌没有给我任何关于这个特定组合的相关答案。

有没有人知道改变禁用 UIBarButtonItem 的颜色的其他方法或使 setTitleTextAttributes 对禁用项目起作用的方法?

0 投票
2 回答
1272 浏览

ios - 如何使用编辑样式将操作分配给 rightbarbuttonitem?

我在导航栏中的视图中有一个编辑 rightbarbuttonitem。我在故事板/IB 的帮助下设置它,而不是通过编程方式。现在,我想要的只是在按下“完成”barbuttonitem(而不是编辑)时分配一个动作。

有没有办法实现它?我手动尝试过-(IBAction),但它不起作用。另外,我想对 UITableView 中的选定项目执行操作。所以如果你给我一个想法,那就太好了。