ios上多平臺開發(.m與.xib關聯)

1、創建一個xib文件,文件類型爲view


2 、選中xib,點擊File's Owner,設置custom class:(對應.m的文件名)


3、選中xib.點擊File's Owner->View,右擊設置view,關聯當前的view即可


if ([[UIDevicecurrentDevice] userInterfaceIdiom] ==UIUserInterfaceIdiomPhone) {

        self.viewController = [[[gnanViewControlleralloc] initWithNibName:@"gnanViewController_iPhone"bundle:nil]autorelease];

    }else {

        self.viewController = [[[gnanViewControlleralloc] initWithNibName:@"gnanViewController_iPad"bundle:nil]autorelease];

    }



發佈了52 篇原創文章 · 獲贊 4 · 訪問量 18萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章