本篇文章介紹了怎么為按鈕位置配置不同的IOS背景的解決辦法,下面小編給大家介紹詳細的解決步驟
面對全屏的背景圖片,要在固定的位置放置多個按鈕的問題我的解決辦法,具體如下:

圖片就是這樣的。再重復一下問題:例如我要在上述全屏的背景上的 M U R P 和 訪問官方網站五個地方放置五個按鈕,要求適配各種型號手機。
我是這樣解決的(StoryBoard):
首先:在storyBoard里面拖4個ViewController,分別設置screen size 為3.5、 4.0、 4.7、 5.5的尺寸。
然后把背景圖片分別設置上去,在固定的地方放置固定的按鈕。
然后在使用的時候通過判斷不同的屏幕尺寸,來加載不同的storyBoard,代碼如下:(swift)。
?
let screenHeight = UIScreen.mainScreen().bounds.size.height
????? var storyBoards:UIStoryboard = UIStoryboard(name: "Main", bundle: nil) as UIStoryboard
????? if (screenHeight ??????? viewCon = storyBoards.instantiateViewControllerWithIdentifier("First . ") as! FirstViewController
????? }else if (screenHeight ??????? viewCon = storyBoards.instantiateViewControllerWithIdentifier("First . ") as! FirstViewController
????? }else if (screenHeight ??????? viewCon = storyBoards.instantiateViewControllerWithIdentifier("First . ") as! FirstViewController
????? }else if (screenHeight ??????? viewCon = storyBoards.instantiateViewControllerWithIdentifier("First . ") as! FirstViewController
????? }
????? var naviCon:MainNavigationController = MainNavigationController(rootViewController:viewCon)
以上所述就是怎么為按鈕位置配置不同的IOS背景的解決辦法的介紹,希望大家能夠喜歡,更多內容請繼續關注武林技術頻道網站!