Domanda

I have created an app for the iPhone where I have two view controllers. Page 1 has a UIImageView and a UILabel, and Page 2 has a UIImagePickerController that allows the user to update the image on Page 1 and a UITextField that allows the user to update the UILabel. The image view on Page 1 has a default image placed there, in case the user doesn't care to change it.

I won't post my code as it works fine as is.

My problem is that if a user chooses to change the image displayed on the first page, I would like to save their choice of image somewhere, so when the app is opened thereafter, their own image of choice will be displayed, rather than the default.

È stato utile?

Soluzione

Look into using NSUserDefaults to save the user's preference (an ivar of some sort). And upon relaunching your app, query the defaults to check for which preference has been selected and load the image based on that preference.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top