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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:54:00+00:00 2026-06-06T08:54:00+00:00

ImageView is defined in class named Third – (void)viewDidLoad { // Displays UIImageView UIImageView*

  • 0

ImageView is defined in class named Third

- (void)viewDidLoad
{
// Displays UIImageView
UIImageView* ImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 300, 235)];
self.view.backgroundColor = [UIColor brownColor];
// load all the frames of our animation
ImageView.animationImages = [NSArray arrayWithObjects:    
                         [UIImage imageNamed:@"3a.png"],
                         [UIImage imageNamed:@"3b.png"],
                         nil];
// all frames will execute in 24 seconds
ImageView.animationDuration = 24;
// start animating
[ImageView startAnimating];
 ImageView.layer.borderWidth = 2;
 ImageView.layer.borderColor = [[UIColor whiteColor]CGColor];    
 [ImageView.layer setMasksToBounds:YES];
 [ImageView.layer setCornerRadius:15.0f];
 [self.view addSubview:ImageView]; }

How can i get reference of this image view.layer from this third class to another class.

Basically i want to use pause layer and resume layer for image view animation.

To use

 [self pauseLayer:myImageView.layer]; // Pause the CALayer of the UIImageView

I should have reference some thing like this but don’t know how to implement it in viewdidload of third class or where to implement it in third class or in another class.

 UIImageView *myImageView = [OtherClass getTheImageView];

So looking for some help.

Thanks.

  • 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-06T08:54:03+00:00Added an answer on June 6, 2026 at 8:54 am

    I solved it. In another class i was loading third class and the code is below

    -(void)Third {
    Third *thirdController = [[Third alloc] init];
    thirdController.view.frame = CGRectMake(0, 0, 320, 480);
    CATransition *transitionAnimation = [CATransition animation];
    [transitionAnimation setDuration:1];
    [transitionAnimation setType:kCATransitionReveal]; 
    [transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
    [self.view.layer addAnimation:transitionAnimation forKey:kCATransitionReveal];
    [self.view addSubview:thirdController.view]; 
    [self.view addSubview:toolbar];
    [thirdController release];
    self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Fourth) userInfo:nil repeats:NO];
    }
    

    i was using same layer in this loading code. So i used that for reference.

    I used

    [self pauseLayer:self.view.layer];
    

    for pausing image view animation and for resuming

    [self resumeLayer:self.view.layer];
    

    So basically in playpauseAction when i m pausing and resuming timer right their i am pausing and resuming image view.layer animation

     -(void)playpauseAction:(id)sender {
    
    if([audioPlayer isPlaying])
    {
        [sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected];
        [audioPlayer pause];
        [self pauseTimer];
        [self pauseLayer:self.view.layer]; 
    }else{
        [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
        [audioPlayer play];
        [self resumeTimer];
        [self resumeLayer:self.view.layer];
     if(isFirstTime == YES)
        {
            self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                                          target:self
                                                        selector:@selector(displayviewsAction:)
                                                        userInfo:nil
                                                         repeats:NO];
            isFirstTime  = NO;
        }
        } 
        }
    

    It was that simple and i wasted my two days to solve this but at last happy that it is working like charm have no issues.

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

Sidebar

Related Questions

I've defined a class MarkerView which extends ImageView and to use this View, I
Assuming I have an ImageView defined as: <ImageView android:id=@+id/my_image_view android:layout_width=wrap_content android:layout_height=wrap_content android:background=@drawable/my_image_view_background /> With
In Android, I defined an ImageView 's layout_width to be fill_parent (which takes up
I've defined my layout something like this - ` <ImageView android:id=@+id/first_icon android:layout_width=wrap_content android:layout_height=wrap_content android:src=@drawable/square
I have a RelativeLayout defined in an xml layout file named 'myview.xml' which contains
I have an ImageView that is defined in the following way: <ImageView android:id=@+id/cover_view android:layout_width=wrap_content
I defined onTouchEvent(MotionEvent event) to receive touch events for imageview. I am using multiple
i am having 20 imageview and i am having 20 button for them when
I have an ImageView in my activity that shows an active symbol when a
I have taken a imageview in applicationDidFinishLaunching as shown below. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary

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.