Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:24:04+00:00 2026-06-14T20:24:04+00:00

Is it possible to initialize an nstimer a certain number of times without having

  • 0

Is it possible to initialize an nstimer a certain number of times without having to set the timer as a property? The reason I want this is because I am constantly allocating new timers at certain periods in my application and so I can’t use a property because once i invalidate the property timer it cant be used anymore.

in the [NSTimer scheduledTimerWithTimeInterval: target:selector: userInfo:nil repeats:] method can i use the target parameter to pass in the timer itself as a parameter in the selector i specify? (sorry, i don’t really no what the target thing means in the method).

if that doesn’t work could I maybe try the [NSTimer scheduledTimerWithTimeInterval: invocation: repeats:] and use the invocation property to help me do this or something? Sorry I don’t know what the invocation parameter in this method is either, I looked at the documentation but I still don’t understand.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:24:05+00:00Added an answer on June 14, 2026 at 8:24 pm

    “target” for a timer means the object you want to run the selector (or method, or action) on.

    And the best way to keep track of how many times you run a timer would be to instantiate some custom Objective C object which has a “counter” or “number of times run” property (or ivar) and then increment it each time the timer runs the method off of that object.

    As soon as the counter passes the number of times you desire, you can invalidate the timer (which is passed in as a parameter to whatever method that you call) and release the custom object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why is it possible to initialize a Dictionary<T1,T2> like this: var dict = new
Why is not possible to initialize a property to a function when you declare
Is it possible to do the following (e.g. initialize bool array and set all
I'm trying to set up a class so that it's possible to initialize it
Since C99 (and C++20), it's possible to initialize structs using this syntax: struct info
Is it possible to initialize and delete QApplication instances many times? The following is
Is it possible to initialize all UI elements of certain type (like all TextViews
Was wondering if it is possible to initialize a text field with printing (this
Is it possible to initialize a NSRunLoop without loading any NIB files (i.e., without
Is it possible to initialize an object that I want to pass as an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.