开发者

Custom view using code or IB

开发者 https://www.devze.com 2023-02-14 17:22 出处:网络
Is there a right/wrong approach开发者_StackOverflow中文版 for creating a Custom view using code or IB? I mean what should be the preferred way of designing a custom view.As for all broad questions, th

Is there a right/wrong approach开发者_StackOverflow中文版 for creating a Custom view using code or IB? I mean what should be the preferred way of designing a custom view.


As for all broad questions, the answer is "It depends what you're trying to do". Both IB and writing code have their merits. Some projects will end up with a bit of both.

There's some discussion here:

http://wiresareobsolete.com/wordpress/2010/03/striking-the-balance-interface-builder-vs-code/


Personally, I started out working with IB. But as I went deeper into iOS development, I started building my views in code....

Gave me a higher sense of control over my view objects.

But, like everyone else says, both ways are correct; It just depends on what you're comfortable with.

Like me, try both and see which one works best for you. You have nothing to lose either way.


I used to do it in code but now I mostly use IB to lay out my views and then do fine tuning in code, like setting the font for a UITextView. Always seems odd that you can't do that one in IB...

0

精彩评论

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