Is there a method like intent.putextra of Android for iOS? -
i'm programming app in both languages: android & ios, i'm trying find way use similar method move data viewcontroller another, intent on android it. code on android is:
at activity sending data:
public void gotouserscreen(usermodel userm) { usermodel = userm; intent intent = new intent(homeactivity.this, profileactivity.class); intent.putextra("user_model", usermodel); intent.putextra("login_model", loginmodel); intent.putextra("notification_model", notificationmodel); startactivity(intent); finish(); } the activity receiving:
intent intent = getintent(); loginmodel = (loginmodel) intent.getserializableextra("login_model"); notificationmodel = (notificationmodel) intent.getserializableextra("notification_model"); usermodel = (usermodel) intent.getserializableextra("user_model"); does know how on ios? way, ios i'm programming on xcode 8, can me solve swift3?
the extras in intent map of parcelable values. in ios can pass nsdictionary uiviewcontroller , parse similar effect. so:
viewcontrollerb *viewcontrollerb = [[viewcontrollerb alloc] initwithnib:@"viewcontrollerb" bundle:nil]; viewcontrollerb.intentdictionary = [[nsdictionary alloc] init]; [self pushviewcontroller:viewcontrollerb animated:yes]; then in viewcontrollerb:
loginmodel *loginmodel = [intentdictionary objectforkey:"login_model"]; notificationmodel *notificationmodel = [intentdictionary objectforkey:"notification_model"]; usermodel *usermodel = [intentdictionary objectforkey:"user_model"];
Comments
Post a Comment