0
我已经创建了一个视图和一个变量并将其加载到视图控制器的loadView方法中。如何在调用loadView方法后将值传递给视图控制器中的视图变量?以编程方式从视图控制器设置iOS设置视图
LocationView.m
#import "LocationView.h"
@implementation LocationView
@synthesize locationTitle;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
locationTitle = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 300, 20)];
[self addSubview:locationTitle];
}
return self;
}
LocationViewController.m
#import "LocationViewController.h"
#import "LocationView.h"
@interface LocationViewController()
@end
@implementation LocationViewController
- (void)loadView
{
CGRect frame = [[UIScreen mainScreen] bounds];
LocationView *locationView = [[LocationView alloc] initWithFrame:frame];
[self setView:locationView];
}
- (void)viewDidLoad
{
[super viewDidLoad];
How do I pass a value to locationTitle here?
}