PDA

View Full Version : Web View and URL?




DeviledMoon
Oct 19, 2010, 07:44 PM
Hey Guys,

Im working on a web app for my mac's that i might release out to everyone when i finish up what im doing with it.

but heres my issue, i cant seem to find a way to load a url into the Web View Component...

Could anyone give me an example of how i can do this?

Thanks,
DeviledMoon



Toreddo
Oct 20, 2010, 03:44 AM
Hey Guys,

Im working on a web app for my mac's that i might release out to everyone when i finish up what im doing with it.

but heres my issue, i cant seem to find a way to load a url into the Web View Component...

Could anyone give me an example of how i can do this?

Thanks,
DeviledMoon

Connect the UIWebView from your IB to your controller by making a property.

Then use this:


NSURL *url = [[NSURL alloc] initWithString:@"http://myurl"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
[[webBrowser mainFrame] loadRequest:request];

DeviledMoon
Oct 21, 2010, 03:29 AM
Connect the UIWebView from your IB to your controller by making a property.

Then use this:


NSURL *url = [[NSURL alloc] initWithString:@"http://myurl"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
[[webBrowser mainFrame] loadRequest:request];



Thanks Man, Worked Wonders :D

kainjow
Oct 21, 2010, 08:31 PM
and don't forget to release those objects, or you'll have memory leaks.

DeviledMoon
Oct 22, 2010, 02:24 AM
and don't forget to release those objects, or you'll have memory leaks.

of course... me and my team just started on the whole apple developer system, we got a lot of apps coming to the mac and iphone/ipod/ipad

i have a basic knowledge of how to develop for the platform, i know enough to get by and kill all the leaks and what not, just some of the stuff in Xcode/cocoa throws me off lol


Thanks for reminding though!

Oh.
Unrelated question, Key commands... lets say i want to use the menu command (OpenApple+Fn+1), how would i detect that? ive look it up on the developer resources from apple, but unfortunately they arent that helpful.

dejo
Oct 22, 2010, 10:44 AM
Oh.
Unrelated question, Key commands... lets say i want to use the menu command (OpenApple+Fn+1), how would i detect that? ive look it up on the developer resources from apple, but unfortunately they arent that helpful.
I'd suggest a new thread for this since it's quite off-topic. :)