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

  • Home
  • SEARCH
  • 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 7933953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:29:18+00:00 2026-06-03T21:29:18+00:00

In my program , I set replace image when I swipe for animation cate

  • 0

In my program , I set replace image when I swipe for animation

cate 1.png -> cate2.png->cate3.png->cate1.png-> ~

and set changing label’s frame by using setframe.

-(void) scrollViewDidScroll:(UIScrollView *)scrollView
{
  int offsetx=(int)scrollView.contentOffset.x;

if(offsetx>0 && offsetx<20)
{

    UIImage * image=[UIImage imageNamed:@"cate1.png"];  
    cateImageview.image=image;

    UIFont * font=[UIFont systemFontOfSize:14];
    [gameLabel setFont:font];

    [gameLabel setFrame:CGRectMake(140,18,50,50)];


    return ;

}

 if(offsetx>20 && offsetx<40)
{

    UIImage * image=[UIImage imageNamed:@"cate2.png"];  
    cateImageview.image=image;

    [gameLabel setFrame:CGRectMake(122,16,50,50)];

    return ;

}
    if(offsetx>40 && offsetx<60)
    {

        UIImage * image=[UIImage imageNamed:@"cate3.png"];  
        cateImageview.image=image;

        [gameLabel setFrame:CGRectMake(113,14,50,50)];

        return ;

    }

    if( offsetx>60 && offsetx<80)
    { 
        UIImage * image=[UIImage imageNamed:@"cate1.png"];  
        cateImageview.image=image;

        [gameLabel setFrame:CGRectMake(103,12,50,50)];

        return ;

    }

   if( offsetx>80 && offsetx<100)
   {

    UIImage * image=[UIImage imageNamed:@"cate2.png"];  
    cateImageview.image=image;

    [gameLabel setFrame:CGRectMake(92,10,50,50)];

       return ;

   }

   if( offsetx>100 && offsetx<120)
   {

    UIImage * image=[UIImage imageNamed:@"cate3.png"];  
    cateImageview.image=image;

    [gameLabel setFrame:CGRectMake(83,8,50,50)];

       return ;

   }

      .
      .
      .

 if(offsetx >820 && offset <840)
      .
      .
 }
  1. Do using replace image way for animation have problem? I want to know a better way.

  2. Do using label’s frame way for animation have problem? I want to know a better way.

  3. label.frame=CGRectMake(~,~,~,~) vs [label setFrame:CGReckMake(~,~,~,~)]
    Is there differences? what?

  • 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-03T21:29:20+00:00Added an answer on June 3, 2026 at 9:29 pm

    1. Animating Image

    You can’t animate changing the image using the image property. If you want to fade the image between one and another you can add a second imageView on the same frame, above your imageView and animate its opacity from 0 to 1. Then when the animation finishes, remove the old imageView or change the image and remove the animated imageView.

    2. Animating Frame

    The frame is an animatable property but simply setting a new value won’t cause an animation. There is no problem using the frame to animate. Look into UIView animations for simple animations like this one:

    [UIView animateWithDuration:yourDurationInSeconds animations:^{
        // Changing the frame in here will cause the frame to animate over the specified duration
        [label setFrame:yourNewFrame];
    }];
    

    3. Dot-notation or not

    label.frame = ...; and [label setFrame:...]; is exactly the same thing. Just two different ways of writing code.

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

Sidebar

Related Questions

I'm trying to multithread something and i have my program set up such that
I need my application installer set the program to auto-startup for all users. Then
This is the program I wrote: set serveroutput on; declare b empl.name1%type; r varchar;
The program I've written is set to only accept positive integers as input. If
This program I use has it's own variables to set when you run it,
I have an existing program we've developed as a large set of Eclipse plugins.
My C# program uses a web browser control and I programmatically set its html
I have the below command line arguments set for the program. argument proc is
I have a working program in C++ that generates data for a Mandelbrot Set.
My program is located at http://server2.abcd.com/myprogram/ . Our webmaster has set up a subdomain:

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.