IOS:为什么视图可以自动调整灵活宽度但不能自动调整灵活高度

时间:2014-11-06 08:57:21

标签: ios autoresize

TimeSharingViewController *con=[[[TimeSharingViewController alloc] init] autorelease];
con.view.backgroundColor=[UIColor clearColor];
con.view.frame=CGRectMake(8, 0, 304, 263);    
con.stockNo=self.stockNo;
con.isDaPan=self.isDaPan;
con.view.autoresizesSubviews=YES;
[cell addSubview:con.view];
[self addChildViewController:con];

@implementation TimeSharingViewController
- (void)viewDidLoad {
    SharingTimeView *sharingTimeView=[[SharingTimeView alloc] initWithFrame:CGRectMake(0, 0, 0.7*self.view.bounds.size.width, 0.5*self.view.bounds.size.height)];
    sharingTimeView.autoresizingMask=UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    sharingTimeView.backgroundColor=[UIColor redColor];
    sharingTimeView.tag=10101;
    [self.view addSubview:sharingTimeView];
}
@end

sharingTimeView的frame.size.width是AutoresizingFlexibleWidth,效果是对的。但sharingTimeView的高度是错误的。为什么呢?

0 个答案:

没有答案