0
我已经经历例如例如尝试后我的项目与别人比较,看看我在做什么错误,但是我还没有找到答案。总之,我正在尝试为课程做的事情是有三个按钮分段控制,将改变UIWebView
显示的网址。分段控制,以改变页的UIWebView
然而,当应用程序是运行它崩溃上推出具有以下控制台输出
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x7f969ab2dd80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key appleWebView.'
*** First throw call stack:
以下是我的代码:
ViewController.M
#import "ViewController.h"
@interface ViewController()
@property (weak, nonatomic) IBOutlet UIScrollView *theScroller;
@property (weak, nonatomic) IBOutlet UISegmentedControl *appleSite1;
@property (weak, nonatomic) IBOutlet UIWebView *myWebView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.theScroller.contentSize = CGSizeMake(280, 1000.0);
}
- (IBAction)appleSite1:(UIButton *)sender
{
NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://www.google.com"]];
[self.myWebView loadRequest:[NSURLRequest requestWithURL:url]];
}
@end
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
//{
// IBOutlet UIWebView myWebView;
//}
//
@end
我只用一个网站(易趣),直到我可以找出我错过什么测试。很显然,我是一名学生,正在学习,所以请耐心等待。
在此先感谢。
您是否在任何地方创建了UiWebView? – 2014-12-11 06:48:42