Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试UIBarButtonItem从xib文件本身为我添加图像。但是,我得到了一个与我的图像大小和形状相同的灰色按钮。xib如何在不手动编写代码的情况下直接从我的文件中正确显示图像?该按钮出现在工具栏上。谢谢并恭祝安康。
UIBarButtonItem
xib
UIButton旁边使用barButtonItem。它会自动在其中生成 abarButton和 a Button。那么您需要将batButtonItem文本更改为“”并Image更改UIButton
UIButton
barButtonItem
barButton
Button
batButtonItem
Image
正如我测试的那样,它会起作用并在旁边显示你的照片barButtonItem