ios - Stretching a UIToolbar background image when rotating to landscape -
i adding image uitoolbar's background in app delegate using code:
[[uitoolbar appearance] setbackgroundimage: [uiimage imagenamed:@"toolbarbackground.png"] fortoolbarposition:0 barmetrics:uibarmetricsdefault]; the image 768 pixels in width (the size of ipad screen width in portrait orientation). when rotate landscape image not stretch fill new screen width (1024 pixels). how can use custom background image on uitoolbar stretches fit screen when rotating?
does toolbar autoresize? if not , set it's autoresizing mask:
[mytoolbar setautoresizingmask: uiviewautoresizingflexiblewidth | uiviewautoresizingflexiblerightmargin]
if toolbar autoresize , image still doesn't , set contentmode of image view uiviewcontentmodescaletofill.
Comments
Post a Comment