【发布时间】:2014-11-26 18:52:30
【问题描述】:
任何人都知道为什么当我使用这段代码时,它不会将视图缩放到屏幕大小。看起来它按原样加载 xib 文件,并且不适合设备的宽度。
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ReceiptView" owner:self options:NULL];
self = (ReciptView *)[nib objectAtIndex:0];
}
return self;
}
这是控制器中的实现:
-(void) bookNowAction
{
ReciptView *v = [[ReciptView alloc] initWithFrame:self.view.frame];
[self.view addSubview:v];
}
【问题讨论】: