Recently written blog more, in fact, most of the previous essays, this section of the collation, released.
Today's article, say, face full-screen background image, to place multiple buttons in a fixed position of the problem of my solution, in fact very earth, not technically, is a method, very labor-saving.
This is the picture. Repeat the question: for example, I want to place five buttons on the full-screen background of M U R P and visit the official website Five places, which requires a variety of models of mobile phones.
That's what I'm dealing with (StoryBoard):
First: Drag 4 Viewcontroller inside the storyboard to set the size of screen size 3.5, 4.0, 4.7, 5.5, respectively. Then set up the background picture separately and place the fixed button in the fixed place.
Then in the use of the time by judging the different screen size, to load the different storyboard, the code is as follows: (Swift).
1Let ScreenHeight =Uiscreen.mainscreen (). Bounds.size.height2 varStoryboards:uistoryboard = Uistoryboard (name:"Main", Bundle:nil) asUistoryboard3 if(ScreenHeight <=480.0) {4 5Viewcon = Storyboards.instantiateviewcontrollerwithidentifier ("First3.5") as!Firstviewcontroller6}Else if(ScreenHeight <=568.0) {7 8Viewcon = Storyboards.instantiateviewcontrollerwithidentifier ("First4.0") as!Firstviewcontroller9}Else if(ScreenHeight <=667.0) {Ten OneViewcon = Storyboards.instantiateviewcontrollerwithidentifier ("First4.7") as!Firstviewcontroller A}Else if(ScreenHeight <=736.0) { - -Viewcon = Storyboards.instantiateviewcontrollerwithidentifier ("First5.5") as!Firstviewcontroller the } - - varNavicon:mainnavigationcontroller = Mainnavigationcontroller (Rootviewcontroller:viewcon)
In this way, you can all fit in.
Want to see the code of the small partner:--> GitHub: to demo of the small partners look over
iOS full screen background, multiple button position adaptation (SWIFT)