UIPicker and Text Field
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 fil开发者_如何学Pythonls 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.
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.
I would suggest best way is to keep a shared NSMutableArray
in AppDelegate, fill it from the UITextField
and use it in UIPicker
.
精彩评论