Sachin Khaire Sachin Khaire - 3 years ago 193
iOS Question

Create Custom view programmatically of dynamic response from server? in Objective-C

My Question is Can I create

custom view
programmatically while server given to me response dynamically like Label, checkbox etc.
I Want to make any
depends on server response.

Answer Source

There are many ways to do this. Here are two:

  1. Use the existing markup language. Storyboards and Xibs are just XML. You can generate that XML on the server, download it at run time, and then use NSBundle loadNibNamed:owner:options:.

  2. You can invent some new markup. That XML format isn't documented, to my knowledge. It's also really hard to read. You might decide some simple json describing the view you want is all you need. So just download json responses and instantiate the views and map the properties. You can get fancy and use things like NSSelectorFromString to invoke the property setters, etc.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download