IPhone development - creating a class like UIImagePickerController that returns data to the parent

I have a situation where I have to accept data from a user using several kinds (for example, Personal Information -> Professional Information -> Executed Process).

I was wondering how I can build a class like UIImagePickerController that takes data from the user and returns data to the parent class? Note that this view is also handled by this class.

0


source to share


1 answer


This is a great example of a delegate pattern.

You create an object, assign a delegate. The object allows you to interact with the user. When the user closes the object view, the object tells the delegate "the selected value here".



This is a standard pattern in Cocoa and Objective-C and you should learn how to use it as you come across it a lot (for example, UITableView or UIImagePickerView use the delegate pattern).

+1


source







All Articles