Should views be created using NIBs or code in iPhone?

前端 未结 6 1573
囚心锁ツ
囚心锁ツ 2021-02-06 18:04

Are there any performance, development drawbacks or advantages when designing views using Interface Builder?

6条回答
  •  自闭症患者
    2021-02-06 18:42

    Speaking for myself, I found interface builder horribly obtuse when I was trying to learn how to develop for the iPhone. The workflow you're supposed to use still doesn't make much sense to me. The interface builder is faster for finicky interface layouts than hand-coding.

    The disadvantage with generating the GUI programmatically in your UIViewControllers is that you've blurred the difference between Views and Controllers in the MVC pattern. If you can keep the GUI generation to the loadView method, you can still keep a decent boundary between code the generates information and code that displays information.

    In short: I much prefer generating GUIs by overriding loadView in the UIViewController subclasses.

提交回复
热议问题