Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
01/22/18 06:31 PM (6 years ago)

Fixed background image auto sizing

Hello all A few weeks back I noticed that the background image used in my app was not autosizing in a BT 4 project as it did in BT3. I use this image when the app refreshes so the user knows that something is happening. BT4 project Xcode 9.2 iOS 10 (with hundreds of depreciation warnings) Found this on Stack Overflow fro 2015 BT_Screens bt_loading bt_loading.m line 43 existing code with package is [self.view setBackgroundColor:[UIColor clearColor]]; I changed it to (from Stack Overflow- bottom of page- <a href="https://stackoverflow.com/questions/30570305/add-image-to-view-background/30570511#30570511" target="_blank" rel="nofollow">https://stackoverflow.com/questions/30570305/add-image-to-view-background/30570511#30570511</a> ) UIImageView *backgroundImage =[[UIImageView alloinitWithFrame:self.view.bounds]; // This will set image fit to all iphone... backgroundImage.image=[UIImage imageNamed:@"yourimage.png"]; [self.view addSubview:backgroundImage]; It works in the Xcode simulator- all phone sizes Give it a try Dave
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/22/18 09:21 PM (6 years ago)
Hey, Thanks Dave! Nabbed and copied! Cheers! -- Smug
 
MacApple
Apple Fan
Profile
Posts: 4674
Reg: Oct 25, 2010
USA
61,140
like
01/23/18 06:18 PM (6 years ago)
Nice one for figuring this out CKid, good man!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.