开发者

After changing AppDelegate to Objective-C++, can't addSubview to UIWindow anymore

开发者_运维百科After adding OpenFeintX, I had to change my AppDelegate to (.mm). Not sure f this is absolutely the reason of the issue but it seems like the only thing that changed.

Now, anything that I addSubview to the UIWindow doesn't actually show. If I put a video, it still plays but shows nothing.

Any ideas?


Finally, I was able to resolve the issue. It seems like, for some still unknown reason, the viewDidLoad and viewWillAppear of my viewController were both called before the application didFinishLaunch. So every time I added a subview, it would add it to a UIWindow that doesn't exist yet. I moved my code to viewDidAppear and that fixed it.

If you have a similar issue, check the memory location of the UIWindow and make sure it is the same UIWindow, you were adding the subview to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜