7
在通用項目中嘗試我的手,我想通過情節提要從標識符加載vc。有沒有辦法避免在訪問故事板時顯式檢查成語。在通用應用程序中獲取主要情節提要
這醜陋的代碼工程....
UIStoryboard *storyboard;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
}
else {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
}
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
但呸。字符串文字主要故事板很難查看(不知道爲什麼該項目無法保存主要故事板設置,以至於應用程序可以說[UIStoryboard mainStoryboard];)但顯式成語檢查太過分了。
是否有任何可以清除此代碼的隱藏智能(可比較「@ 2x」圖像後綴支持視網膜顯示)?
謝謝。一石二鳥。希望我可以兩次上癮。 – danh 2013-04-11 16:12:19
謝謝Desmond! – Oritm 2014-06-25 12:48:31