1

我继承了一个 Appcelerator 项目,更新到 IOS7 SDK 打破了 iPad 中的拆分视图。
我收到此错误 [INFO] 无法将窗口添加为视图的子视图。返回。
据我所知,代码正在尝试创建缺失的视图并将其添加到窗口中。我相信这可能与Appcelerators 迁移指南的这一部分有关!它指的是IOS7新窗口架构。其他所有内容似乎都没有问题地添加到窗口中。我不确定这是否重要,但它是一个 universla iPhone/iPad 应用程序。我真的根本不使用 IOS 应用程序或 Appcelerator,我将不胜感激。

    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
4

1 回答 1

1

Window 对象不能包含另一个 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();
于 2013-10-29T00:48:32.323 回答