我有一个名为 Company 的类,我想重写该init
方法。我想在此方法中包含公司徽标。我试过这个:
- (id)init
{
self = [super init];
if (self) {
self.companyName = @"";
self.companyLogo = nil;
self.companyDesc = @"";
self.companyYear = 0;
}
return self;
}
- (id) initWithCompanyName: (NSString*)companyName companyLogo: ***(UIImage*)companyLogo***
companyDescription: (NSString*)companyDesc foundationYear: (NSInteger)foundationYear
{
self = [self init];
if(self)
{
self.companyName = companyName;
self.companyLogo = companyLogo;
self.companyDesc = companyDesc;
self.companyYear = foundationYear;
}
return self;
}
显然它不可能是 UIImage。那么我该怎么做才能在初始化中包含图像呢?