[問題] UIView autoresize後位置以及大小錯誤!
有個ui layout上的問題想請教一下有經驗的大大,
問題如下:
有一個parent view: UIViewA size從: 768x1024 resize成508x891
而加在UIViewA上的UIViewB 的size卻從768x70 resize成508x0
Hight變成0, 且y的位置也超出UIViewA! (跑到(0,954)的位置上)
請問一下可能是甚麼原因?
code如下:
- (void)loadView
{
UIView *aView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
aView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
aView.autoresizesSubviews = YES;
self.view = [aView autorelease];
bView = [[UIView alloc] initWithFrame:CGRectMake(0.0, self.view.bounds.size.height - 70.0, self.view.bounds.size.width, 70.0)]; bView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
bView.backgroundColor = [UIColor redColor];
[self.view addSubview:bView];
}
不知道遇到甚麼問題為什麼resize後的位置以及大小都跑掉了!
試著把uiviewB的高度調大一點可以看到view了但是位置卻是錯誤的!
想請教一下關於autoresizingMask這個屬性該如何正確使用才能使subview
正確的附加在parent view上面呢?
感謝大大們~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.34.53.233