ios - Accessing another View Controller's IBOutlets Housed in a Container View -


i have container view holds 1 of 3 view controllers swapped out 3 tabs (across bottom).

here's storyboard:

enter image description here

i'm taking approach can have custom tabs , single save button fields in big form.

how can access iboutlets in 3 child view controllers inside entry detail view controller class?

here's i've done try , access in parent.

//entryflightinfoviewcontroller.h (child 1) @property (strong, nonatomic) iboutlet uitextfield *aircraftidtextfield; 

then in parent class (entry detail view controller) can't access property:

//entrydetailviewcontroller.m (parent) #import "ppentryflightinfoviewcontroller.h"  - (ibaction)buttonsave:(id)sender {   nslog(@"save: %@", _aircraftidtextfield); //(!) error: use of undeclared identifier '_aircraftidtextfield' } 

how access view controller's iboutlets when in container view? i'm on right track. forgive me i'm still quite new objective-c. :)

the short answer can't unless write own communication layer. can @ different views via childviewcontrollers (mentioned above) getting own custom pointers in prepareforsegue method call view loaded container view. (see this link more info on this) work great if forcing user visit each page. if not same defaults you'd load there on first viewdidload can saved without checking specific view controller.

apple's answer never have save button. if edit it, meant it, , it's saved immediately. =)

that said, you, i'd have object of views access load/unload data storage whenever show/hide different views, possibly in viewdidload/viewdiddisappear. way have "known good" object ready saving, , won't have directly access view controllers.

hope helps some.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -