zoukankan      html  css  js  c++  java
  • stuck with

    I can guess what might be the problem here, because I've done it:

    I've found that often when I add init code to loadView, I end up with an infinite stack trace

    Don't read self.view in -loadView. Only set it, don't get it.

    The self.view property accessor calls -loadView if the view isn't currently loaded. There's your infinite recursion.

    The usual way to build the view programmatically in -loadView, as demonstrated in Apple's pre-Interface-Builder examples, is more like this:

    UIView *view = [[UIView alloc] init...];
    ...
    [view addSubview:whatever];
    [view addSubview:whatever2];
    ...
    self.view = view;
    [view release];

    And I don't blame you for not using IB. I've stuck with this method for all of Instapaper and find myself much more comfortable with it than dealing with IB's complexities, interface quirks, and unexpected behind-the-scenes behavior.

  • 相关阅读:
    自定义ProgressBar
    Anroid开发中常用快捷键
    Intent用法
    IO(Input Output)流
    自定义Dialog
    仿UC点击两次返回键退出程序
    横竖屏切换时Activity的生命周期
    单例模式
    Timer用法
    关于数组
  • 原文地址:https://www.cnblogs.com/pencilCool/p/4759248.html
Copyright © 2011-2022 走看看