1
我无法解决AppDelegate.swift中的错误。无法将表达式的类型'()'转换为键入'UINavigationController?'
我收到一条消息'无法转换表达式的类型'()'来键入'UINavigationController?'
任何一个给我的建议?
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
let tabBarController = UITabBarController()
let alarmViewController = AlarmViewController(style: .Plain)
let recorderViewController = RecorderViewController()
let playViewController = PlayViewController()
let tabController1 = UINavigationController(rootViewController: recorderViewController)
tabController1?.tabBarItem = UITabBarItem(title: "Recorder", image: UIImage(named: "tabbar_microphone"), tag: 1)
let tabController2 = UINavigationController(rootViewController: playViewController)
tabController2?.tabBarItem = UITabBarItem(title: "Cheer me up!", image: UIImage(named: "tabbar_play"), tag: 2)
let tabController3 = UINavigationController(rootViewController: alarmViewController!)
tabController3?.tabBarItem = UITabBarItem(title: "Alarm", image: UIImage(named: "tabbar_alarm"), tag: 3)
******* here's a place I got the message 'Cannot convert the expression's type '()' to type 'UINavigationController?' *******
tabBarController.viewControllers = [tabController1, tabController2, tabController3]
window?.rootViewController = tabBarController
window?.makeKeyAndVisible()
return true
}
真的很感谢您的回答! – 2014-10-01 05:26:32