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
Post a Comment