我在课堂上有这个设置:
- (void)viewDidAppear:(BOOL)animated
{
NSLog(@"test");
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"get_business_ideas" ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:htmlFile];
NSURLRequest *rq = [NSURLRequest requestWithURL:url];
[theWebView loadRequest:rq];
}
NSLog 语句从未出现在我的日志记录屏幕中,但其余代码似乎工作,因为 uiWebView 确实呈现。这怎么可能?这是一个新项目,所以也许我必须设置一些东西以确保可以看到日志记录?
谢谢!
更新:这是整个文件:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
//load iphone image
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"building"]];
imgView.frame = self.view.bounds; // to set the frame to your view's size
[self.view addSubview:imgView];
[self.view sendSubviewToBack:imgView];
}
else
{
//load ipad image
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"building@2x"]];
imgView.frame = self.view.bounds; // to set the frame to your view's size
[self.view addSubview:imgView];
[self.view sendSubviewToBack:imgView];
}
NSLog(@"2");
}
- (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.
}
@end