Re: [問題] 如何取空白可畫圖的大小?
※ 引述《offname (Loafer是了好)》之銘言:
: ※ 引述《zonble (zonble)》之銘言:
: 這個和官方文件說的有點出入
: 文件提到
: Your custom implementation of this method should not call super
: iOS Reference Library : http://goo.gl/mnhLl
: 重點是不要直接呼叫 loadView
那是因為 UIViewController 在 loadView 的預設行為,是會去
載入 nib。所以文件說 override 掉 loadView 不要去呼叫 super,
是因為,如果要自己手動產生 view,又用 super 的行為載入 nib,
兩邊會打架。
但是這個 UIViewController subclass 沒有 nib 檔案的話,影響就
比較小,就是給一個空白的 self.view,不過其實不是很好的實作就
是了,標準的 loadView 作法還是要自己給一個 self.view。例如
UIView *aView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
aView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view = [aView autorelease];
scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
scrollView..autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:scrollView];
--
zonble.net
cocoa.zonble.net
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.182.144
推
12/26 15:32, , 1F
12/26 15:32, 1F
→
12/26 15:32, , 2F
12/26 15:32, 2F
討論串 (同標題文章)