iphone - Using NSTimer in NSObject class -


i displaying custom uiview (which uialertview) on clicking button in many view controllers.so, have included code in nsobject class. have display uitableview subview custom view, , 1 of uitableview cell contains countdown timer. able display customview , uitableview. but, not able implement nstimer in customview.

code display custom view:

+(nsmutabledictionary *) printpopup:(uiview *)inputview {     int i=20;      uiview *mycustomview = [[uiview alloc] initwithframe:cgrectmake(20, 100, 280, 250)];     [mycustomview setbackgroundcolor:[uicolor colorwithred:(247/255.0) green:(239/255.0) blue:(218/255.0) alpha:1]];     uitableview *dynamictable=[[uitableview alloc]initwithframe:cgrectmake(0, 0, 280, 250) style:uitableviewstyleplain];     dynamictable.tag=55;     [mycustomview addsubview:dynamictable];         uibutton *cancelbutton = [uibutton buttonwithtype:uibuttontyperoundedrect];     //    [cancelbutton settitle:@"cancel" forstate:uicontrolstatenormal];     [cancelbutton setbackgroundimage:[uiimage imagenamed:@"delete3.png"] forstate:uicontrolstatenormal];     [cancelbutton setframe:cgrectmake(250, 0, 30, 30)];     cancelbutton.tag=i+7;     [mycustomview addsubview:cancelbutton];     [inputview addsubview:mycustomview];     [uiview animatewithduration:0.4f animations:^{         [mycustomview setalpha:1.0f];     }];     nsmutabledictionary *returneddic=[[nsmutabledictionary alloc]init];     [returneddic setobject:dynamictable forkey:@"tableview"];     [returneddic setobject:cancelbutton forkey:@"cancelbutton"];     return returneddic;  }  + (void)dismisscustomview:(uibutton *)sender {     [uiview animatewithduration:0.2f animations:^{         [sender.superview setalpha:0.0f];     }completion:^(bool done){         [sender.superview removefromsuperview];     }];  } 

when trying implement nstimer in nsobject class, getting following error:

instance variable accessed in class method 

i have call nstimer in class. there alternatives.

please suggest.

the syntax using defining methods of class methods (the little + before return type). if want instance methods should prefixed minus sign -. since seem require access instance variables, methods should instance methods.

note instance methods still have access of static "class" variables.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -