Have myTimer defined in class One
@property (nonatomic, retain) NSTimer *myTimer;
@synthesize myTimer;
- (void)viewDidLoad {
myTimer = [NSTimer scheduledTimerWithTimeInterval:2.6
target:self
selector:@selector(updateView:)
userInfo:nil
repeats:YES];
[super viewDidLoad];
}
- (void)updateView:(NSTimer *)theTimer
{
if (index < [textArray count])
{
self.textView.text = [self.textArray objectAtIndex:index];
self.imageView.image = [self.imagesArray objectAtIndex:index];
index++;
}else{
index = 0;
}
I want to pause and resume myTimer in mainviewcontroller class.
In mainviewcontroller.h
@property (nonatomic, strong) ClassOne *oneclass;
and in mainviewcontroller.m
@synthesize oneclass;
then via UIButton in mainviewcontroller pausing and resuming myTimer
-(void)playpauseAction:(id)sender {
if([audioPlayer isPlaying])
{
[sender setImage:[UIImage imageNamed:@"music.png"] forState:UIControlStateNormal];
[audioPlayer pause];
[myTimer invalidate];
}else{
[sender setImage:[UIImage imageNamed:@"audiostop.png"] forState:UIControlStateNormal];
[audioPlayer play];
[myTimer fire];
if(isFirstTime == YES)
{
self.timer = [NSTimer scheduledTimerWithTimeInterval:06.0
target:self
selector:@selector(displayviewsAction:)
userInfo:nil
repeats:NO];
isFirstTime = NO; } } }
But getting semantic issue and ARC Semantic issue error
unknown receiver myTimer did you mean NSTimer. No known class method for selector invalidate and fire
Thanks for help.