ios - Display data in other view controllers -


this question has answer here:

in storyboard have set facebook login fetches users username , profile picture. have done in initial uiviewcontroller (aka loginviewcontroller).

what want able send data (the username , profile picture) other places. more specifically, want able to:

  • display fetched profile picture in uiimageview in different uiviewcontroller
  • display username in text field in different uiviewcontroller

if tell me how either code example or storyboard walkthrough appreciative.

save details retrieved in loginviewcontroller using nsuserdefaults. system provided convenient storage gives nsdictionary access. can retrieve details other controllers.

to save loginviewcontroller,

[[nsuserdefaults standarduserdefaults] setobject:@"user1" forkey:@"username"] ; [[nsuserdefaults standarduserdefaults] setobject:uiimagejpegrepresentation(image, 1.0) forkey:@"picture"] ; 

to retrieve view controller,

nsstring *username = [[nsuserdefaults standarduserdefaults] objectforkey:@"username"] ; uiimage *image = [uiimage imagewithdata:[[nsuserdefaults standarduserdefaults] objectforkey:@"picture"]] ; 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -