ios - Why is the button not on the side for both phones? -


i tried doing auto layout, making button appear on edges, on iphone 5 it's on edge , on iphone 6 it's in middle region.

 next = uibutton()     let me = "next.png"     next.setimage(uiimage(named: me), forstate: .normal)     next.frame = cgrectmake(250, 370, 40, 40)     next.settranslatesautoresizingmaskintoconstraints(false)     next.addtarget(self,action: "nexter:", forcontrolevents: uicontrolevents.touchupinside)     self.view.addsubview(next)      let horizontalconstraintnext = nslayoutconstraint(item: next, attribute: nslayoutattribute.leading, relatedby: nslayoutrelation.equal, toitem: view, attribute: nslayoutattribute.leading, multiplier: 1, constant: 285)     view.addconstraint(horizontalconstraintnext)      let verticalconstraintnext = nslayoutconstraint(item: next, attribute: nslayoutattribute.top, relatedby: nslayoutrelation.equal, toitem: view, attribute: nslayoutattribute.top, multiplier: 1, constant: 350)     view.addconstraint(verticalconstraintnext)      let widthconstraintnext = nslayoutconstraint(item: next, attribute: nslayoutattribute.width, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 40)     next.addconstraint(widthconstraintnext)      let heightconstraintnext = nslayoutconstraint(item: next, attribute: nslayoutattribute.height, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 40)     next.addconstraint(heightconstraintnext) 

the computer doing told do. saying in constraints "put button 285 points left edge". well, appears in relation whole screen depends on screen's right edge is!

so, if isn't mean, don't that. example, if want fix relative right edge, fix relative right edge, not left edge.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -