0

NameSubViewControllerNameSubView添加到ViewController.m

#import "NameSubViewController.h"
#import "NameSubView.h"

...

 - (void)viewDidLoad
{
[super viewDidLoad];

NameSubViewController *nameController = [[NameSubViewController alloc] initWithNibName:@"NameSubViewController" bundle:nil];
NameSubView *nameSubView = (NameSubView *)[nameController view];
}

但我想为它们创建属性,以便我可以从视图的每个部分访问它们。写什么ViewController.h来声明那里的属性?

4

1 回答 1

1

。H

@property (nonatomic, retain) NameSubView *nameSubView;

.m 下划线@implementation

@synthesize nameSubView;
于 2012-08-29T21:16:46.443 回答