I wrote some stuff to find your view controller within the storyboard and/or within the view hierarchy based on the class name of the view controller.
Some of it is a little new some of it is a little old. One trick (on iOS) is that you will need to check if your root controller is a nav controller or not. The way I have seen the tag property used is arbitrary and leads to problems and assumptions. If you plan on using it for this purpose, create an enum with all the possible values for your view's tag. Or create a category on UIViewController and add an NSString called controllerIdentifier and a method for viewControllerInstanceFromIdentifier which returns what you want when given the identifier and only use this within the controllers that require it. > I have a view controller that I instantiate in my Storyboard. This view > controller has an embedding view inside it's view, and this embedding > view has another view controller in it. inside its* view I had to beat this into my head, and what I came up with follows. "In a case where it's not clear if the contraction or the possessive should get the apostrophe, the contraction wins and gets the apostrophe." That's how I had to learn it. - Alex Zavatone On Apr 5, 2017, at 4:06 PM, Doug Hill wrote: > Thanks for the follow up. > I saw this but I happen to have multiple embedded view controllers. While > it's possible to do a search, it's more difficult because there are multiple > embed view with the same view controller class. Let's say, views are in > position 1, 2, and 3 and I want to configure 1, 2, and 3 differently based > on their position. > I'm thinking of making a outlet to the embedding view and then compare this > view with view controllers in childViewControllers. But seems like a lot of > busy work It would be great to be able to more easily lookup the view > controller for a particular embed view. Any chance? > > Doug Hill > https://github.com/djfitz/SFFontFeatures > <https://github.com/djfitz/SFFontFeatures> > > >> On Apr 5, 2017, at 1:55 PM, Quincey Morris >> <quinceymor...@rivergatesoftware.com> wrote: >> >> On Apr 5, 2017, at 13:42 , Doug Hill <cocoa...@breaqz.com >> <mailto:cocoa...@breaqz.com>> wrote: >>> >>> Can this be done? Are there other ways to get a reference to the embedded >>> view controller at runtime? >> >> I believe you’ll find the embedded view controller in the root view >> controller’s “childViewControllers” array property. >> > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com > > This email sent to z...@mac.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com