ios - SplitView Controller not showing -


i'm trying same thing in adaptivephotos wwdc 2014 sample app have appdelegate.swift following code:

class appdelegate: uiresponder, uiapplicationdelegate, uisplitviewcontrollerdelegate {  var window: uiwindow!   func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: nsdictionary?) -> bool {     // override point customization after application launch.     window = uiwindow(frame: uiscreen.mainscreen().bounds)     var splitviewcontroller = uisplitviewcontroller()     var searchboxviewcontroller = searchboxviewcontroller()     var searchresultdetailviewcontroller = searchresultdetailviewcontroller()     var navigationcontroller = uinavigationcontroller(rootviewcontroller: searchboxviewcontroller)     splitviewcontroller.viewcontrollers = [navigationcontroller, searchresultdetailviewcontroller]     splitviewcontroller.delegate = self     nslog("%@", splitviewcontroller.viewcontrollers)     var mainviewcontroller = mainviewcontroller()     mainviewcontroller.view.backgroundcolor = uicolor.redcolor()     mainviewcontroller.viewcontroller = splitviewcontroller     window.backgroundcolor = uicolor.whitecolor()     window.rootviewcontroller = mainviewcontroller     window.makekeyandvisible()     return true }  func applicationwillresignactive(application: uiapplication) {     // sent when application move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state.     // use method pause ongoing tasks, disable timers, , throttle down opengl es frame rates. games should use method pause game. }  func applicationdidenterbackground(application: uiapplication) {     // use method release shared resources, save user data, invalidate timers, , store enough application state information restore application current state in case terminated later.     // if application supports background execution, method called instead of applicationwillterminate: when user quits. }  func applicationwillenterforeground(application: uiapplication) {     // called part of transition background inactive state; here can undo many of changes made on entering background. }  func applicationdidbecomeactive(application: uiapplication) {     // restart tasks paused (or not yet started) while application inactive. if application in background, optionally refresh user interface. }  func applicationwillterminate(application: uiapplication) {     // called when application terminate. save data if appropriate. see applicationdidenterbackground:. }  } 

and have mainviewcontroller.swift this:

class mainviewcontroller: uiviewcontroller {  var viewcontroller : uiviewcontroller {     didset {         addchildviewcontroller(viewcontroller)     } }  init(nibname nibnameornil: string?, bundle nibbundleornil: nsbundle?) {     viewcontroller = uiviewcontroller()     super.init(nibname: nibnameornil, bundle: nibbundleornil)     // custom initialization }  init(coder adecoder: nscoder!) {     viewcontroller = uiviewcontroller()     super.init(coder: adecoder) }  override func viewdidload() {     super.viewdidload()      // additional setup after loading view. }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of resources can recreated. }   /* // #pragma mark - navigation  // in storyboard-based application, want little preparation before navigation override func prepareforsegue(segue: uistoryboardsegue?, sender: anyobject?) {     // new view controller using [segue destinationviewcontroller].     // pass selected object new view controller. } */  } 

but splitview controller doesn't show. not navigation controller bar. there i'm doing wrong?

thank you

i forgot put in view.addsubview(viewcontroller?.view) in didset. solved.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -