Saturday 15 May 2010

objective c - How to replicate the launch image in iOS -



objective c - How to replicate the launch image in iOS -

my main app has work in webview, want maintain launch image longer while work takes place. this, created controller uiimageview , i'm loading default image in it:

self.imageview.image = [uiimage imagenamed:"default"]; // these tend fill screen, end distorting image //self.imageview.contentmode = uiviewcontentmodescaleaspectfill; //self.imageview.contentmode = uiviewcontentmodescaleaspectfit; //self.imageview.contentmode = uiviewcontentmodescaletofill; // keeps aspect same, doesn't fill screen self.imageview.contentmode = uiviewcontentmodecenter;

this works, except when real launch image goes away , replaced mine, have 2 white bars - 1 @ top , 1 @ bottom - image doesn't fill. i've tried set contentmode various fill/fit's, , though has desired effect of filling total screen, stretches , distorts image slightly.

so i'm wondering - launch image i'm not doing? how can replicate display user can't tell it's different image?

like in project utilize launch image , in first uiviewcontroller called have uiimageview inside. image resolution, must same screen's definition. code in uiviewcontroller :

cgrect fullframe = [[uiscreen mainscreen] bounds]; // img background uiimageview *background; if (fullframe.size.height <= 480) { background = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"image-480h.png"]]; } else if (fullframe.size.height <= 568) { background = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"image-568h.png"]]; } else if (fullframe.size.height <= 668) { background = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"image-668h.png"]]; } else { background = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"image-736h.png"]]; } background = cgrectmake(0, 0, frame.size.width, fullframe.size.height); mymainview = [[uiview alloc] initwithframe:frame]; [mymainview addsubview:background]; self.view = mymainview;

i check different screen size depending on iphone 4, 5, 6 , 6 plus.

ios objective-c

No comments:

Post a Comment