2013-10-28 24 views
1

我已經繼承了一個Appcelerator項目,並且更新到iOS7 SDK已經打破了iPad中的分割視圖。
我收到此錯誤[信息]無法將視窗添加爲視圖的子視圖。返回。
盡我所知,代碼試圖創建並添加缺少的視圖到窗口。我相信這可能與Appcelerators Migration Guide的這一部分有關!它引用IOS7新窗口體系結構。一切似乎都被添加到窗口沒有問題。我不確定這是否重要,但它是一個universla iPhone/iPad應用程序。 我真的不用iOS應用程序或Appcelerator,我會很感激任何支持。Appcelerator Titanium 3.x/IOS7不能添加窗口作爲視圖的子節點

function StyledWindow(title) { 
     var self = Ti.UI.createWindow({ 
     title  :title, 
     backgroundImage : '/images/bg-window.png', 
     barImage : '/images/header.png', 
     barColor : '#e6c661', // currently set to gold. Blue is #14243d. This appears to only work on iOS 7 
     navTintColor : '#e6c661', // sets text color for what used to be nav buttons 
     tabBarHidden : true, 
     translucent : false, // This value removes the translucentsy of the header in iOS 7 
     statusBarStyle :Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT, // This sets the window title to white text. 
     }); 

     return self; 
    }; 
    var artWindow = new StyledWindow(); 
    var self = new StyledWindow('Articles'); 
    self.add(artWindow); // this is where the error occurs 
+0

可以在一個窗口不添加到視圖。因此,將您的'StyledWindow'改爲View,而不是窗口。 –

回答

1

窗口對象不能包含另一個Window對象。

而不是調用StyledWindow()兩次,使用Ti.UI.createView()並把它添加到頂級窗口:

function StyledWindow(title) { 
    var self = Ti.UI.createWindow({ 
    title: title, 
    barImage : '/images/header.png', 
    barColor : '#e6c661', 
    navTintColor : '#e6c661', 
    statusBarStyle: Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT, 
    }); 

    return self; 
}; 

var artWindow = new Ti.UI.createView({ 
    backgroundImage : '/images/bg-window.png', 
}); 

var self = new StyledWindow('Articles'); 
self.add(artWindow); 
self.open(); 
相關問題