ios - Background image in Swift -


i creating application fixed background (2208x2208) every screen, why setting background in application delegate. current code inside didfinishlaunchingwithoptions method is:

func setbackground() {     let width = self.window!.frame.size.width// * uiscreen.mainscreen().nativescale     let height = self.window!.frame.size.height// * uiscreen.mainscreen().nativescale      let size = max(width, height)      uigraphicsbeginimagecontext(cgsize(width: width, height: height))      uiimage(named: "background.jpg")?.drawinrect(cgrectmake(-(size - width) / 2, -(size - height) / 2, size, size))      let image = uigraphicsgetimagefromcurrentimagecontext()      uigraphicsendimagecontext()      self.window?.backgroundcolor = uicolor(patternimage: image!) } 

this works supposes, 1 issue. image looks scaled down , scaled scale of screen. on iphone 6 plus doesn't sharp. might expected behaviour since window size not full resolution. when multiply native scale, 1/9th image (upper left) shown. there way (besides providing separate resolutions image) show without scaling first?

a second issue, if know solution this. image shown behind uinavigationcontroller every view inside uiviewcontroller has transparent background. works , shows background, 1 problem, background turns little darker when navigation view. because animation. there way hide animation? inside uiviewcontrollers (there 2 yet, inside class overridden) following code:

override func viewwillappear(animated: bool) {     self.view.alpha = 1.0     super.viewwillappear(animated) }  override func viewwilldisappear(animated: bool) {     uiview.animatewithduration(0.25, animations: {         self.view.alpha = 0.0     })     super.viewwilldisappear(animated) } 

even without code, still turns darker before goes light again. looks view still dark opaque background low alpha , when presenting second screen, lays both backgrounds on top of each other until second screen presented , first 1 removed.

thanks!


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -