[英]How to create multiple UIViews Inside the UIPageviewController using iOS storyboard?
[英]How to create init methods for UIViews in storyboard?
我有一个带有两个属性的PLButton
类:
@property (strong, nonatomic) UIColor *purpleColor;
@property (strong, nonatomic) UIColor *grayColor;
及其初始化程序:
- (instancetype)init {
if (self = [super init]) {
self.purpleColor = [UIColor colorWithRed:142.0/255.0 green:23.0/255.0 blue:126.0/255.0 alpha:1.0];
self.grayColor = [UIColor colorWithRed:239.0/255.0 green:239.0/255.0 blue:239.0/255.0 alpha:1.0];
}
return self;
}
另外我有一个PLEventButton
作为的子类PLButton
:
和内部的初始化程序:
- (instancetype)init {
if (self = [super init]) {
return self;
}
return self;
}
我在情节提要中分配给UIButtons的那些类。 为什么这些属性在PLButton和PLEventButton(它们均为nil)中都不起作用?
情节提要中的对象通过initWithCoder方法进行初始化。 因此,只需在其中调用您的初始化方法。
- (id)initWithCoder:(NSCoder*)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
[self myInitialization];
}
return self;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.