manually writing a Storyboard

一曲冷凌霜 提交于 2021-02-05 06:42:25

问题


So far I have seen documentation of how to write a storyboard with Interface Builder. I prefer writing the code manually though. Can a storyboard be developed manually without interface builder in xcode?


回答1:


I would not recommend this, however, if you right click on your storyboard file in the Project Navigator choose the option Open As > Source Code you can hack away to your heart's delight.

I would imagine you'd prefer editing a Storyboard using IB as you'll just be creating more work for yourself debugging various syntax issues that the editor would have abstracted away for you. Note, that the XML is compiled at build-time into the binary files called nibs, then loaded and instantiated at run-time to create the views. Getting your hands dirty with that will slow you down.

https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/Edit_User_Interfaces/edit_user_interface.html#//apple_ref/doc/uid/TP40010215-CH6-SW1

BTW @Kenny's suggestion to write your views in code is a good one if you really don't want to use XIBs or Storyboards




回答2:


If you prefer writing code, I would suggest doing everything programmatically and not using storyboards at all.




回答3:


Do you use a text editor to write text files? Then use the storyboard editor to write storyboards.

At the end of the day, if you wanted to reverse engineer a storyboard file you could do that, and then hard code your own, new one using what you've learned.

Here's a clue: XML.

Alternatively, ignore storyboards completely, and just programatically create all your views, segues and transitions. That is perfectly feasible.



来源:https://stackoverflow.com/questions/25313883/manually-writing-a-storyboard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!