最近專案遇上純hardCode編寫UI,

刪除storyBoard後就沒辦法順利編譯,

如有遇到此問題請參考以下步驟,

1. 在appDelegate.m檔中的didFinishLaunchWithOptions加入以下程式碼

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.rootViewController = [[NSClassFromString(@"ViewController") alloc] init];
    [self.window addSubview:self.window.rootViewController.view];
    [self.window makeKeyAndVisible];
    
    return YES;
}

2. info.plist中, 點選減號移除main storyboard file base name此項目

接著就可到viewdidload寫些UI元件測試看看囉

 

arrow
arrow
    文章標籤
    ui storyboard hardcode ios
    全站熱搜

    Will 發表在 痞客邦 留言(0) 人氣()