I have a questionary, and want to show multiple and different kind of questions in one page(a date picker, texbox, picker..etc.) These will be created runtime from an xml, and all these questions also will have their own;
-question labels
-a hidden label under the question for its validation alerts
-and maybe a few more labels around the question for explainaiton..etc.
So for each question on the page I need to use multiple controls, what is the best approach here:
-Use a scroll View and add my questions dynamically, but each question already has a few other components, how can I define this? can I create a view object for each question, add its components to the questions objcets and add questions to the scroll view? if so how?
-Or should I use table view I think it already categorizes the components you add in each cell?
-Or should I subclass some fancy Ui classes an开发者_如何转开发d do some fancy delegations? but how?
I am new to objective C so if answers are a bit explainatory I will be glad.
Thanks
Depends what you want from a design perspective, do you want to be able to go back to previous questions? and are the questions in a linear order? if so I would consider using UINavigationController to keep pushing new views onto the stack, each view would have a question.
Also, instead of having hidden uilabels for your alerts, consider using UIAlertView(it looks much cooler)
I reckon you should use a UITableView. You would then need to create few custom UITableViewCell in Interface Builder, one for each type of question you want to support.
It is probably the easiest way as the SDK provides almost everything you need. Moreover, you can find many tutorials and StackOverflow questions on the subject.
精彩评论