Note that there are some explanatory texts on larger screens.

plurals
  1. POCant pause and resume nstimer in another class
    primarykey
    data
    text
    <p>Have myTimer defined in class One</p> <pre><code> @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 &lt; [textArray count]) { self.textView.text = [self.textArray objectAtIndex:index]; self.imageView.image = [self.imagesArray objectAtIndex:index]; index++; }else{ index = 0; } </code></pre> <p>I want to pause and resume myTimer in mainviewcontroller class.</p> <p>In mainviewcontroller.h</p> <pre><code>@property (nonatomic, strong) ClassOne *oneclass; </code></pre> <p>and in mainviewcontroller.m</p> <pre><code>@synthesize oneclass; </code></pre> <p>then via UIButton in mainviewcontroller pausing and resuming myTimer</p> <pre><code>-(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; } } } </code></pre> <p>But getting semantic issue and ARC Semantic issue error</p> <p><strong>unknown receiver myTimer did you mean NSTimer. No known class method for selector invalidate and fire</strong></p> <p>Thanks for help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload