為按鈕位置配置不同的IOS背景_IOS

來源:互聯網
上載者:User

面對全屏的背景圖片,要在固定的位置放置多個按鈕的問題我的解決辦法,具體如下:

圖片就是這樣的。再重複一下問題:例如我要在上述全屏的背景上的 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背景的介紹,希望大家喜歡。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.