objective c - How to fade picture loading process with an UIActivityIndicatorView? -
i have created custom uitableviewcell. custom cell contents imageview picture of current article. on creation of cell image loaded internet , displayed in uiimageview. how can fade downloading process activityindicatorview?
i'm sorry bad english :-) use online translator.
if i'm understanding correctly, seems want uiimageview's (that lazily downloaded in realtime) fade in once have downloaded. , while downloading, display spinning uiactivityindicatorview wheel.
here suggest:
1) instead of defining custom view in table cell uiimageview specifically, use more generic uiview. because both classes (uiimageview , uiactivityindicatorview) subclasses , can set such.
2) initially, , cells, set uiview uiactivityindicatorview (don't forget use "startanimating" spin) , on callback function download completion, go appropriate cell , set custom uiview downloaded uiimageview.
3) achieve fade in effect, @ following code:
// sets image transparent imageview.alpha = 0.0f; // animates image fade in on 1.0 second [uiview animationwithduration:1.0f animations:^{ imageview.alpha = 1.0f; }]; 4) might need call "setneedsdisplay" on table cell refresh it's subviews after setting new image view, , before animating it.
Comments
Post a Comment