ios - Centering a UIImageView inside a UIScrollView -


i trying center uiimageview in scroll view. here code tried no results.

uiimageview *iv = [[uiimageview alloc] initwithimage:[uiimage imagenamed:kreceiptdetailscrollviewbackgroundcornered]]; [iv setcontentmode:uiviewcontentmodecenter]; [[self scrollview] insertsubview:iv atindex:0]; 

anybody know what's wrong this?

you set image view's content mode center, means image not scaled , can larger image view displays it.

uiimage *image = [uiimage imagenamed: kreceiptdetailscrollviewbackgroundcornered]; uiimageview *iv = [[uiimageview alloc] initwithimage: image]; iv.contentmode = uiviewcontentmodescaleaspectfit; iv.frame = [self scrollview].bounds; [[self scrollview] addsubview: iv]; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -