#import "WebViewController.h"
@implementation WebViewController
@synthesize webView, output_message;
- (id)initWithNibNameNSString *)nibNameOrNil bundleNSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Initialization code
}
return self;
}
/*
If you need to do additional setup after loading the view, override viewDidLoad. */
- (void)viewDidLoad
{
NSString *urlAddress = @"http://bizbook.x10.mx/dictionary.php";
NSString *message;
int number;
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
// Load into an NSDictionary if the highest level is a <dict>
NSDictionary *myData = [ [ NSDictionary alloc ] initWithContentsOfURL: @"http://bizbook.x10.mx/dictionary.php" ];
// Load into an NSArray if the highest level is an <array>
//NSMutableArray *myArray = [ [ NSMutableArray alloc ] initWithContentsOfURL: @"http://bizbook.x10.mx/print.php" ];
message = [myData objectForKey: @"Fruit"];
output_message.text = message;
}
- (BOOL)shouldAutorotateToInterfaceOrientationUIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[webView release];
[output_message release];
[super dealloc];
}
@end