0

I have the same kind of question as this person How to Sync selected row of UIPicker with previously entered data

I want the picker to load with info from a text field in another tab. I'll explain.

I have a doctor tab where the user fills in all the info about their doctor or add from contacts. In another tab where they need to reference a doctor, instead of asking them to type in the same info I figure just use a picker.

But I would like to know if creating a NSMutableArray in the init, using -viewDidLoad: and then of course dealloc is just as sufficient as iterating. And should I have a separate class for the picker and just reference it?

Hope my question makes sense. Thanks in advance!

I apologize, I forgot to add I'm using Core Data if that makes a difference at all. But thanks to iamsult and the69geeks for the answers, I'll considering both.

Community
  • 1
  • 1
Tremaine
  • 45
  • 11

2 Answers2

0

I would suggest best way is to keep a shared NSMutableArray in AppDelegate, fill it from the UITextField and use it in UIPicker.

Prashant Rane
  • 436
  • 4
  • 11
  • Thanks for the answer I forgot to add I'm using Core Data if that makes a difference to your answer. I'm sorry. I should have added that. – Tremaine May 17 '11 at 12:00
0

First of all create object for class A say doctorTab in class B (reference tab). Now access the array of class A through object doctorTab from class B.

NSMutableArray *referencedDoc = [[NSMutableArray alloc]init];
referencedDoc = doctorTab.doctorArray;

doctorArray is the array defined in class A.

Hope this would work for you.

CoolBeans
  • 20,654
  • 10
  • 86
  • 101
iamsult
  • 1,581
  • 1
  • 15
  • 21
  • Thanks for the answer I forgot to add I'm using Core Data if that makes a difference to your answer. I'm sorry. I should have added that. – Tremaine May 17 '11 at 12:01