UITabBar在顶部或其他?

我是新来的swift,将创build一个用户界面,其中显示一个tabor,当我通过苹果的人机界面的指导方针 ,他们说,不使用UITabBar顶部。 我们可以通过自定义来使用它,但是很多人在App Store中提交时会被拒绝。

所以,而不是UITabar应该使用顶部的标签?

您应该在导航栏中使用分段控件,如本例中的iOS人机界面指南所示:

https://developer.apple.com/ios/human-interface-guidelines/ui-controls/segmented-controls/

导航栏中的分段控制

可能吗? 当然,但是这违反了人机界面指南。

Swift版本

import UIKit class TabViewController: UITabBarController, UITabBarControllerDelegate { override func viewDidLoad() { super.viewDidLoad() self.delegate = self // Do any additional setup after loading the view. } override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() self.tabBar.invalidateIntrinsicContentSize() var tabSize: CGFloat = 44.0 let orientation = UIApplication.sharedApplication().statusBarOrientation if UIInterfaceOrientationIsLandscape(orientation) { tabSize = 32.0; } var tabFrame = self.tabBar.frame tabFrame.size.height = tabSize tabFrame.origin.y = self.view.frame.origin.y self.tabBar.frame = tabFrame self.tabBar.translucent = false self.tabBar.translucent = true } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }