ios - auto adjusting UI elements for iphone4S and iphone5 -


after long search how display ui elements correctly on both iphone4s , iphone5.i confused whats best way display ui elements in xib.should use autoresizing feature in size inspector or should use auto layout?if use autoresizing, image gets distorted. ,i have seen people doing below

nsstring *filename = @"image.png";     cgrect screenrect = [[uiscreen mainscreen] bounds];     if (screenrect.size.height == 568.0f)         filename = [filename stringbyreplacingoccurrencesofstring:@".png" withstring:@"-568h.png"];      self.imageview.image = [uiimage imagenamed:filename]; 

can assist me how should proceed problem?

i think method right code more cleaner way put this.

nsstring *filename; cgrect screenbounds = [[uiscreen mainscreen] bounds];     if (screenbounds.size.height == 568) {         filename = @"image.png";         self.imageview.frame = cgrectmake(0,0,400,300);     } else {         self.imageview.frame = cgrectmake(0,0,300,300);     } self.imageview.image = [uiimage imagenamed:filename]; 

and if want change size of imageview accordingly iphone can use code.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -