On Nov 16, 2015, at 15:30 , Scott Berry <sb356...@gmail.com> wrote:
> 
> In my main storyboard I’d like to call my web view “BrowseAirports.”  How do 
> I tell Xcode to do this so that when I call the code to open the web view it 
> knows that my web view in storyboard is “BrowseAirports”?

OS X or iOS? What do you mean by “open the web view”? On a Mac, you generally 
open windows which contain a given view. On iOS, you segue to a view controller 
that contains the view.

Probably the correct approach involves setting an outlet to the view from the 
view controller:

1. Subclass the view controller that contains the view (if you aren’t already 
using a custom subclass).

2. Add an outlet to the view controller called (say) ‘browseAirports’. Since an 
an outlet is a kind of instance variable, it’s recommended to lowercase the 
first letter.

3. In the storyboard, drag a connection from the view controller’s outlet to 
the view itself.

4. Refer to the view in code as ‘myViewController.browseAirports’.

Of course, this means you need a reference to the view controller, if you don’t 
already have one. How you do that will depend on which platform you’re using.

I don’t think there’s any reasonable way to refer to a view *by name*, since 
views don’t really have names. You can refer to views by *tag* (a numeric 
identifier), or there are other ad-hoc things you could do, such as locate the 
view at a known place in your view hierarchy (and checking it’s of the correct 
view class), but an outlet is the normal way to do something like this.

_______________________________________________

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

Reply via email to