再次您好,我試圖在下面的應用程序中顯示錯誤,如果沒有互聯網連接。這裏是文件。 FirstViewController.h:在iPhone應用程序中顯示沒有互聯網錯誤
//
// FirstViewController.h
// DailyJoke
//
// Created by John Bridge on 5/4/11.
// Copyright 2011 Bridge and co. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
IBOutlet UIWebView *webView;
}
@end
這裏是FirstViewController.m: // // FirstViewController.m // DailyJoke // // 創建者約翰·橋11年5月4日。 //版權所有2011 Bridge and co。版權所有。 //
#import "FirstViewController.h"
@implementation FirstViewController
-(void)awakeFromNib
{
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.johnbridge180.com/IPhoneIPad/IPhone/DailyJoke/DailyJoke.html"]]];
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
我仍然困惑srry即時通訊新 – 2011-05-10 01:36:13
你應該花時間去嘗試的示例代碼或者在放棄之前閱讀更多文檔。 – pzearfoss 2011-05-10 01:37:54