简体   繁体   中英

Add subview from nib or programmatically

Just a concept question. What would you prefer doing and why, should you need to insert into a view a subview, would you rather have a nib file to add it or would you programatically insert it? I am talking about xcode 4.~ development using storyboards.

Regards, Guy.

That depends on your situation. If it's something very simple or something dynamic (variable number of buttons for example) then I would do it programmatically. If it's a complex but static view (something like a settings view) then I would try using IB.

I personally will do it programmatically if i need the view to be dynamic . But it can be done even with the view created in the xib file. I would prefer creating in xib if the the view needs no dynamism so that it would reduce my coding portion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM