Can't create outlets in File's Owner on Xcode 4.5.1

Hi,

Thanks for looking.


I'm having issues with xcode 4.5.1. and i am new to developing.


I'm trying to build a basic UIWebView page and don't have the viewcontroller.xib on the left hand side, i've seen a post which told me how to make one. it worked but once i type the programming into the viewcontroller H+M screens then go back to the page, drag and drop the UIWebView object into the page it won't let me put the outlet onto the page, it just comes up with "delegate"


Any help would be great


Regards


Craig

MacBook Pro, Mac OS X (10.7.4)

Posted on Oct 20, 2012 9:13 AM

Reply
23 replies

Oct 20, 2012 11:29 AM in response to Craigv513

Second, the brackets have the form [A B:1:2:3]


A is a 'class' which is a collection of a fundamental bit of programming with any number of attached 'methods' of additional programming. B is a method of A. 1,2 and 3 are arguments that B will use in its programming.


Altogether, everything in the brackets returns a value in place of the brackets when the application is running.

Oct 20, 2012 11:37 AM in response to Craigv513

Third, an IBOutlet is a special type of variable that assigns the ability to be connected to a button.


If you want variable myVariable to be capable of holding an NSString, then you have to declare


NSString *myVariable


If you want myVariable to be capable of holding an integer, then you have to declare


int myVariable


etc. If you want myVariable to be connectable to a button in an .xib file, then you have to declare


IBOutlet myVariable


I may be wrong on some details, but this is the general idea.

Oct 20, 2012 11:48 AM in response to mark133

i'm definately thinking this is way above my ability.


The more i look at it it looks like the NSURLRequest *myRequest = [NSURL RequestWithURL:myURL]; is the script linking to *myURL which is defined in the previous line NSURL *myURL = [NSURL URLWithString:@"http//www.google.com"];


so does the star denote the item your defining?? followed by the = which is the method?

Oct 20, 2012 12:05 PM in response to Craigv513

That looks more like what it should be to define myRequest. NSURL defines the type of variable, and *myRequest provides the name of the variable. The * means that the name of the variable has to be assigned a memory location for the actual value of the variable to be stored in. Everything after the = is what gets stored in the memory location. so since the the equals is in brackets, everything in the brackets will produce (or 'return') a value that is placed in the corresponding memory location for *myURL. Once myURL is then defined, you can refer to myURL without the *.


The brackets define (or 'return') a value by first calling on the 'class' (a group of related methods) and then naming the method with any of the necessary or optional arguments that the method will use to generate its result. The result then is 'returned' and put in place of the brackets at run time.

Oct 20, 2012 12:34 PM in response to msuper69

The trouble i'm having is once i type the code (which is identical to the one i saw in a tutorial which worked) i dont have a file's owner button to link the outlet to my view controller page.


i also have no standard .xib viewcontroller which i believe is the reason i have no file's owner button.

i can create one using file=new=window. but then it wont show the outlet for me to link to the uiwebview page


i am new to coding and app building


hope that makes sense.

Oct 21, 2012 10:22 AM in response to Craigv513

If you are learning from a video, you can't follow directions step-by-step unless the video was prepared with the exact same Xcode version you are using. That is one reason I prefer to follow the Apple documentation and example projects.


If your objective is to open a web page in a UIWebView, only four steps are required.


1. Create a new project using using the Single View Application template.


2. On the storyboard, drag a Web View onto the view controller.


3. Create the IBOutlet by Ctrl+dragging the web view into the header. Xcode will automatically add this property to the interface. No other code is necessary to implement the IBOutlet.

@property (weak, nonatomic) IBOutletUIWebView *webView;

4. Load the web page into the web view in the view controller's viewDidLoad.

- (void)viewDidLoad

{

[superviewDidLoad];

NSURL *url = [NSURLURLWithString:@"http://www.google.com"];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

[self.webView loadRequest:request];

}

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can't create outlets in File's Owner on Xcode 4.5.1

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.