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