У меня есть приложения, написанные на Objective C. Я не могу загрузить веб-страницу в UIWebView. UIWebViewDelegate не работает. Мой код приложения;
#import <UIKit/UIKit.h>
@interface Reklamlarim : UIView <UIWebViewDelegate>
- (void)webSayfasiYukle;
@end
Я сделал это так .м стр. webViewDidFinishLoad и webView didFailLoadWithError: не работает.
#import "Reklamlarim.h"
@implementation Reklamlarim
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self webSayfasiYukle];
}
return self;
}
- (void)webSayfasiYukle{
NSLog(@"webSayfasiYukle");
UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
webView.delegate = self;
NSString *url=@"http://www.google.com";
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webView loadRequest:nsrequest];
[self addSubview:webView];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"webViewDidFinishLoad");
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSLog(@"webView didFailLoadWithError");
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)aRequest navigationType:(UIWebViewNavigationType)navigationType {
return YES;
}
У меня есть устройство iOS 8, xcode 6.3. Я извиняюсь за мой плохой английский. Благодарность ...