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.
我以编程方式设置了UITabBarController3 个视图,但其中的图标UITabBar看起来不像我想要的那样。有没有办法以编程方式调整/移动它们?
UITabBarController
UITabBar
中的图标UITabBar是实例UITabBarItem,它是 的子类UIBarItem。
UITabBarItem
UIBarItem
UIBarItem有一个名为的属性imageInsets,我认为这正是您正在寻找的。
imageInsets
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIBarItem_Class/Reference/Reference.html#//apple_ref/occ/cl/UIBarItem
我想代码看起来像:
UIEdgeInsets insets = { .top = 3, .left = 0, .bottom = 4, .right = 3 }; self.tabBarItem.imageInsets = insets;
您也可以尝试修改原始图像文件,使其更好地放置在空间中。