를 표시하지 내가 가진 내가 그런 다음있는 UIWebView아이폰 OS -있는 UIWebView는 HTML
을 넣어 내가 .H 파일이 추가하는 내부의 UIViewController에 :
#import <UIKit/UIKit.h>
@interface BuildBusinessController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *theWebView;
@end
과하는 .m 파일
로이가#import "BuildBusinessController.h"
@interface BuildBusinessController()
@end
@implementation BuildBusinessController
@synthesize theWebView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
theWebView.delegate = self;
}
- (void)viewDidUnload
{
[self setTheWebView:nil];
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)viewDidAppear:(BOOL)animated
{
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"build_business" ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:htmlFile];
NSURLRequest *rq = [NSURLRequest requestWithURL:url];
[theWebView loadRequest:rq];
}
@end
그러나 build_business.html 파일 뷰 내부 렌더링되지 않으며, 또한 나는이 줄에 경고를 얻을 : theWebView.delegate = 자기; 이는 말한다 :
이 const_string 호환되지 않는 유형의 BuildBusinessController *에서 UIWebViewDelegate 'ID에 할당
사람이 알겠습니까 은 내가 잘못 여기에 무엇을 을하고 있는가? F.X. 외에도
#import <UIKit/UIKit.h>
@interface BuildBusinessController : UIViewController <UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *theWebView;
@end
죄송합니다, 그 라인이 정확히 어디에 있어야하나요? loadRequest를 인식하지 못했습니다. viewDidAppear의 마지막 행을 의미합니다. 작동하지 않습니다. – GeekedOut
스토리 보드를 사용하여 웹보기를 만들었습니까? – Alan
예 스토리 보드를 사용하여 뷰를 만들었지 만 수동으로 코드를 작성했습니다. 이것이 문제 일 수 있습니다. – GeekedOut