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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:21:10+00:00 2026-06-02T06:21:10+00:00

I have a class method where I want to perform this piece of code

  • 0

I have a class method where I want to perform this piece of code below. the problem is that in a class method you can’t use something like self.view. so I’m a bit stuck here. I’ve found some stuff about using [self class] but I don’t really understand how to use that in my piece of code.

for (UIView *view in [self.view subviews]) 
    {
        if([view isKindOfClass:[Circle class]]) {

            [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationCurveLinear animations:^{
                view.alpha = 0;
                view.frame = CGRectMake(self.view.frame.size.width/2-35, self.view.frame.size.height/2-35, 70, 70);
            } completion:nil];

            [view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.4];
        } else {
            //
        }
    }

UPDATE with more info

I have a Circle class.
in that class I have this method

- (IBAction)playerTap:(id)sender {


    NSString *numberString;
    numberString = [NSString stringWithFormat:@"%i",indexNumber+1];

    if (indexNumber < 14)
    {


    if ([label.text isEqualToString:numberString]) 
    {
    [UIView animateWithDuration:0.1 animations:^{


        self.transform = CGAffineTransformMakeScale(1.2, 1.2);

    } completion:^(BOOL finished) {

       [UIView animateWithDuration:0.05 animations:^{
           self.transform = CGAffineTransformIdentity;
           self.alpha = 0.2;

       } completion:nil];

    }];

    ++indexNumber;
    } 
    } else {

        self.alpha = 0.2;

        [NUMViewController gameHasEnded];

    }

}

when the indexNumber (a static variable) has reached a certain amount I want a method in my NUMViewController Class to be performed. I.E. the “gameHasEnded” method.

that would be a method with the code at the beginning of this post. it will remove all other circle instances from the view.

a class method seemed the most logical for me because I’m not performing the method on the circle object but it affects all the objects in my other class.

  • 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-02T06:21:12+00:00Added an answer on June 2, 2026 at 6:21 am

    It is not meaningful to have a class method that calls self.view. The class does not have a view, and there is no way to know which instance you mean. Why are you doing this in a class method? Move it to a the instance. If you have a shared singleton instance, than class methods can refer to it, but this is generally a bad idea and should be avoided if possible (since it ties your class to the singleton).

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

Sidebar

Related Questions

I have a method in a class in another file that I want to
I'm using Java. I want to have a setter method of one class that
This is best explained using code. I have a generic class that has a
I want to create a method that compares a number but can have an
I have a class whereby a method calls a nested class. I want to
I have a class A with a public method in C#. I want to
I have a C# class method that return a xml document not file. How
i have bug that i cannot find, i have Class Point with method who
I have a class with some method that depend by one parameter. What is
I have a class with a method called DataIn(int InputID, string CSVValue) , this

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.