0

ライブラリ ファイル (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 はコードをコンパイルしませんでした (割り当て属性を持つプロパティ '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
4

0 に答える 0