【发布时间】:2014-09-18 12:50:22
【问题描述】:
在IOS8我不能在UIScrollView下面添加UIView。我使用的代码如下
UIScrollView *MainScroll=[[UIScrollView alloc]init];
MainScroll.backgroundColor=[UIColor redColor];
MainScroll.frame=CGRectMake(0, 0, 365,470);
[self.view addSubview:MainScroll];
UIView *HeaderView=[[UIView alloc]init];
HeaderView.backgroundColor=[UIColor orangeColor];
HeaderView.frame=CGRectMake(0,0,width,20);
[MainScroll addSubview:HeaderView];
在此代码中,HeaderView 未放置在 MainScroll 的起点。它位于 UIScrollView 的一些空格之后。此问题仅在 IOS8 中发生。但在 IOS7 中它工作正常,符合我的预期。
【问题讨论】:
-
您使用的是 iOS 8 Beta 版吗?因为您的代码在 iOS7 和 iOS8 中运行良好。
-
这是测试版