开发者

How start animation of activity indicator when click on button?

I have code in which I have array of vi开发者_Python百科ew in scroll view. In each view I create image view and button. Now i want to set a event on button that is when click on button then activity indicator will appear on view and start animation and when finish upload of next view or image then stop and hide activity indicator. What I will do in code so that it work? How do that? In short i want to display activity indicator on view when click on button and hide when neat view appear.


make a function and call that on button click, and add this code in your function

    spinner = [[UIActivityIndicatorView alloc]    initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    [spinner setCenter:CGPointMake(480/2.0, 128.0/2)]; // (mid of screen) I do this because I'm in landscape mode
    [yourView addSubview:spinner];  
    [spinner startAnimating];       
    [spinner release];  

Use this to remove the spinner: [spinner removeFromSuperview];

here spinner is, UIActivityIndicatorView *spinner; (I've declared in .h of ma code)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜