我是新來的swift,打算創建一個UI,其中顯示了一個tabor,當我通過蘋果的人機界面指南時,他們表示不會在頂部使用UITabBar。我們可以通過自定義來使用它,但是很多人說在App Store中提交時會被拒絕。UITabBar在頂部還是其他?
因此,而不是UITabar頂部的標籤應該使用什麼?
我是新來的swift,打算創建一個UI,其中顯示了一個tabor,當我通過蘋果的人機界面指南時,他們表示不會在頂部使用UITabBar。我們可以通過自定義來使用它,但是很多人說在App Store中提交時會被拒絕。UITabBar在頂部還是其他?
因此,而不是UITabar頂部的標籤應該使用什麼?
你應該在這個例子中使用導航欄分段控制,形成了iOS人機界面指南:
https://developer.apple.com/ios/human-interface-guidelines/ui-controls/segmented-controls/
這可能嗎?當然,但它違反了人機界面指南。
斯威夫特版本
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.
}
*/
}
您可以創建一個包含按鈕的視圖,並在上面放置視圖。您可以根據您的UI要求自定義視圖和按鈕。 – ebby94