简体   繁体   English

如何为UITabBar ButtonItem使用UIBarButtonSystemItem图标?

[英]How can I use UIBarButtonSystemItem icons for UITabBar ButtonItem?

It looks like the systemItem property doesn't exist on the viewController.tabBarItem is there a way to set UIBarButtonSystemItem as an image for a UITabBarItem programmatically? 它看起来像systemItem财产上不存在viewController.tabBarItem有没有一种方法来设置UIBarButtonSystemItem作为一个图像UITabBarItem编程?

Thanks 谢谢

You can't use UIBarButtonSystemItem icons with a UITabBarItem . 您不能将UIBarButtonSystemItem图标与UITabBarItem一起使用。 Instead, use UITabBarSystemItem icons. 而是使用UITabBarSystemItem图标。

let barItem = UITabBarItem(tabBarSystemItem: .bookmarks, tag: 1) // or whatever item you want

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM