源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

为按钮位置配置不同的IOS背景

  • 时间:2021-11-25 16:32 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:为按钮位置配置不同的IOS背景
面对全屏的背景图片,要在固定的位置放置多个按钮的问题我的解决办法,具体如下: [img]http://files.jb51.net/file_images/article/201507/2015073015090118.png[/img] 图片就是这样的。再重复一下问题:例如我要在上述全屏的背景上的 M U R P 和 访问官方网站五个地方放置五个按钮,要求适配各种型号手机。 [b]我是这样解决的(StoryBoard):[/b] 首先:在storyBoard里面拖4个ViewController,分别设置screen size 为3.5、 4.0、 4.7、 5.5的尺寸。 然后把背景图片分别设置上去,在固定的地方放置固定的按钮。 然后在使用的时候通过判断不同的屏幕尺寸,来加载不同的storyBoard,代码如下:(swift)。
[u]复制代码[/u] 代码如下:
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背景的介绍,希望大家喜欢。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部