我有一个具有UITabBar和webview的ViewController。触摸选项卡时,webview会加载不同的URL。我似乎无法弄清楚如何确保更多按钮显示而不是压缩标签栏中的9个标签。
import UIKit
class HomeViewController: UIViewController, UITabBarDelegate {
@IBOutlet var webView: UIWebView!
@IBOutlet var tabBar: UITabBar!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(true);
let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults()
let isLoggedIn:Int = prefs.integerForKey("ISLOGGEDIN") as Int;
if (isLoggedIn != 1) {
self.performSegueWithIdentifier("goto_login", sender: self)
} else {
//self.usernameLabel.text = prefs.valueForKey("USERNAME") as NSString
tabBar.delegate = self;
tabBar.selectedItem = tabBar.items?.first as UITabBarItem;
loadPage("http://mywodlog.com");
}
}
答案 0 :(得分:1)
标签栏通常由UITabBarController
管理。
您的HomeViewController
是根视图控制器吗?将其替换为UITabBarController
。为Web视图创建单独的视图控制器。