0

I am making an app at the moment but I am faced with an issue. I am new enough to the world of iOS development so please be patient. In my app a user registers by inputing data into cells in a tableView. e.g name, profile photo etc..

If registration is successful the user is then sent to their home page where I have a UIImageView and a UIlabel.

The issue I am wondering how I can make sure that this UILabel and UIImageView are set according to the user. e.g when user A logs in or registers the UIImageView matches the image they used when registering and so on and so forth for userB, userC etc...

Any suggestions would be great and I hope I am clear in what I am trying to achieve?

Rajesh
  • 10,318
  • 16
  • 44
  • 64

3 Answers3

0

Once the user press the loginButton Button in the resgisterViewController. You'll have to pass a NSString for your UILabel and an UIImage for you UIImageView in the MainViewController.

Follow this answer (Passing Data Forward) step-by-step on how to do that. You RegsiterViewController will be the ViewControllerA and MainViewController will be ViewControllerB in that answer.

Community
  • 1
  • 1
Ty Lertwichaiworawit
  • 2,950
  • 2
  • 23
  • 42
  • Thanks for the comments guys. So just to be clear i can pass the data for UILabel via an NsString variable and then on the homeVC i will just load this NSString to the UILabel on my hone VC. And repeat this for registration process also? Also guys i am using say email for login and i want the UILabel on the homeVC to be equal to the users name that they supplied at registration which is sent to database.. – Raymond Smith Aug 26 '14 at 13:14
  • Will do thanks guys :) i will try this and post if i have issue – Raymond Smith Aug 26 '14 at 14:04
  • @RaymondSmith Hey ray, I can't really help if I don't know what you've done at all. I suggest you post a new question of your error and show your code and describe things in detail. – Ty Lertwichaiworawit Aug 26 '14 at 16:33
0

You can create an initWithUser: method for instantiating your profileViewController, in which the User object has properties indicating the userName and imageName, for example. On viewDidLoad you assign these to your UIImageView and UILabel.

0

Fo reducing the confusion you can store the all data locally in some variable or dictionary and then you use the same. To use it on other view controllers just make those variables or dictionary globally accessible.

Chetan
  • 2,004
  • 1
  • 13
  • 21