我正在尝试从我的 ViewController 调用 UIView FirstScreen。
但是我不知道该怎么做。
View Controller :
#import "ViewController.h"
#import "FirstScreen.h"
@interface ViewController ()
{
FirstScreen *f;
}
FirstScreen.m:
#import "FirstScreen.h"
@implementation FirstScreen
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self didLoad];
}
return self;
}
-(void) didLoad{
[self addLabel];
[self addImageView];
}
最佳答案
@implementation FirstScreen
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self didLoad];
}
return self;
}
-(void) didLoad
{
f = [[FirstScreen alloc] initWithFrame:CGRectMake(0, 0, self.view.size.width, self.view.size.height)];
[self.view addSubview:f];
}
关于ios - 从 UIController 调用 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30863933/