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 6555457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:49:21+00:00 2026-05-25T12:49:21+00:00

So I have this custom class with just a test method that does nslog.

  • 0

So I have this custom class with just a test method that does nslog. I am going to reuse this method many times in my app. The interface looks like this.

@interface TestViewController: UIViewController {  CMImageMover * imageMover }

Then in the view did load I:

imageMover = [[CmImageMover alloc] init];

If I do:

[imageMover testMethod];

Right after the alloc and init it works in the viewDidLoad function but if I call it again from another function in the view controller nothing works and the class method does not get called.

What am I doing wrong here. Every other var I declare like NSArray/NSTimer, I do the say way and I am able to access and use it throughout my controller.

  • 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-05-25T12:49:22+00:00Added an answer on May 25, 2026 at 12:49 pm

    When you say “if I call it again from another function in the view controller nothing works” then first thing to check is what you are sending the testMethod. It could be nil, in which case nothing will happen. In objective C sending a message to nil does nothing. Add an NSLog to find out, e.g.

     NSLog(@"imageMover object is: %@", imageOver);
     [imageMover testMethod]; 
    

    If the NSLog shows it is nil – or something crazy – then follow up what you are doing with the imageMover ivar.

    You mention a class method in your question, but don’t refer to it in your code snippets.

    If you have defined testMethod as a class method it will, of course, fail if you send that message to an instance. (And it will fail noisily.) A class method would be introduced like this:

     + (void) testMethod
     {
           NSLog(@"CMImageMover testMethod called on Class");
     }
    

    An instance method would be introduced like this:

     - (void) testMethod
     {
           NSLog(@"testMethod called on an instance of CMImageMover");
     }
    

    Apologies if this is all screamingly obvious to you and missing the point of the question. It’s not that clear from your question where the issue lies.

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

Sidebar

Related Questions

I have this question: Does implementing a custom MembershipProvider class needs you to implement
I have a custom class that uses boost mutexes and locks like this (only
I have a custom class that implements that IComparable. This class is stored in
I have a custom class that implements ICollection , and this class is readonly,
I have a custom control that inherits from .NET's CompositeControl class. This control overrides
I have a working custom UserNamePasswordValidator that calls into my Oracle DB. This class
I have a std::multimap where key is a custom class. Something like this: Class
I have been looking to implement a custom class of : IList<ArraySegment<byte>> this will
I have a class with a custom indexer like so public string this[VehicleProperty property]
I have a class which is marked with a custom attribute, like this: public

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.