I\'m an Android developer working on an iOS version of our app. I need to know how to achieve behavior similar to startActivityForResult on Android. I need to show a new view co
If we assume you want to open an activity from your own application, then it's easy. An android activity can be represented by a view controller (UIViewController
).
The architectures of iOS and Android are very different. The activities on Android are independent, the controllers on iOS are tightly connected in an application. You have to decide how to show the controller on the screen (usually using a UINavigationController
, or present it modally using presentViewController:animated:
) and connect it to the parent controller somehow to receive the result. A delegate pattern is most appropiate for this.
If you want to start an activity defined in another application or start a system activity (e.g. to take a camera picture), you have to use one of the predefined controllers (e.g. UIImagePickerController). On iOS you can't simply use controllers from a different applications in the same way as Android does.
And I can recommend you another thing - don't write an iOS app with Android design patterns. Think about what is common on iOS and implement the UI that way. Don't just copy Android code.