遇到了個奇怪的問題,界面顯示出來後,uiscrollview 上面的子view 向下移動的一段,打斷看 發現 contentoffset 在willappear 還是正常的(0,0),但是在didappear時就變爲(0,-64)了。追本溯源發現是因爲 ios7後 第一個加到self.view上面的子view後自動的向下偏移-64,把uiscrollview設爲非第一個add的subview即可解決問題。
UIImageView*qq=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, w, h)];
qq.image=[UIImage imageNamed:@""];
[self.view addSubview:qq];
sc=[[UIScrollView alloc]initWithFrame:CGRectMake(10,80, 355, 100)];
sc.backgroundColor=[UIColor blueColor];