I am trying to load a NSView as a subview in another NSView. Am I using the correct code?:
my.h file:
my.m file:
I'm wanting my "mainView" NSView to display the "hyperlinkGeneratorView" NSView.
my.h file:
Code:
#import <Foundation/Foundation.h>
@interface HTMLCode : NSObject {
//Main Window
NSButton *linkGenerator;
NSButton *imageGenerator;
NSButton *videoGeneratorHTML5;
NSView *mainView;
//Link Generator
NSView *hyperlinkGeneratorView;
}
//Main Window
@property (assign) IBOutlet NSButton *linkGenerator;
@property (assign) IBOutlet NSButton *imageGenerator;
@property (assign) IBOutlet NSButton *videoGeneratorHTML5;
@property (assign) IBOutlet NSView *mainView;
//Link Generator
@property (assign) IBOutlet NSView *hyperlinkGeneratorView;
- (IBAction)loadLinkView:(id)sender;
@end
my.m file:
Code:
#import "HTMLCode.h"
@implementation HTMLCode
@synthesize linkGenerator;
@synthesize imageGenerator;
@synthesize videoGeneratorHTML5;
@synthesize mainView;
@synthesize hyperlinkGeneratorView;
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
[B]- (IBAction)loadLinkView:(id)sender {
hyperlinkGeneratorView = [[NSView alloc] init];
[mainView addSubview:hyperlinkGeneratorView];
}[/B]
@end
I'm wanting my "mainView" NSView to display the "hyperlinkGeneratorView" NSView.