Xcode(为mac os创建应用程序)。 WebView不下载页面

时间:2013-11-09 14:24:49

标签: objective-c xcode macos cocoa webview

库文件(AppDelegate.h):

#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>
{

    @private
   __unsafe_unretained NSWindow *window;
   __unsafe_unretained WebView *wview;


}


@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet WebView *wview;



@end

在我私下添加__unsafe_unretained之前,Xcode没有编译我的代码(具有assign属性的属性'window'的现有实例变量'window'必须是__unsafe_unretained)。

主文件(AppDelegate.m):

#import "AppDelegate.h"

@implementation AppDelegate
@synthesize window;
@synthesize wview;


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{

    [[wview mainFrame]loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: @"http://vk.com"]]];

}

- (IBAction)wview:(id)sender {


    [[wview mainFrame]loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString:@"http://vk.com"]]];

}

@end

0 个答案:

没有答案