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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:37:54+00:00 2026-05-27T06:37:54+00:00

I have a custom UIView with nested views of type UIImageView, UILabel and UIButton.

  • 0

I have a custom UIView with nested views of type UIImageView, UILabel and UIButton. The view is created in code like this:

- (void)setupView
{
    popupView = [[UIView alloc] initWithFrame:CGRectMake(-116, -61, 247, 59)];
    popupView.autoresizingMask = 63;
    UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bubble.png"]];
    bgImageView.autoresizingMask = 63;
    [popupView addSubview:bgImageView];
    [bgImageView release];

    textLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 8, 180, 20)];
    textLabel.autoresizingMask = 63;
    textLabel.font = [UIFont fontWithName:@"DefaultNormal" size:16];
    textLabel.text = @"DYNAMIC TEXT";
    [popupView addSubview:textLabel];

    popupButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
    [rightAccessoryButton setImage:[UIImage imageNamed:@"btn-tick.png"] forState:UIControlStateNormal];
    popupButton.frame = CGRectMake(208, 8, 32, 32);
    popupButton.autoresizingMask = 63;
    [popupView addSubview:rightAccessoryButton];
}

I’ve set all their autoresizingMasks to 63 which is basically everything in the ON position (I don’t know a better way of doing that except putting all the constants on a huge line of code!). Then when they need to animate the popup, I do this:

- (void)animateIn
{   
    float pw = 247;
    float ph = 59;

    // set the view's initial position
    popupView.frame = CGRectMake(-pw*0.005+8, -ph*0.01-2, pw*0.01, ph*0.01);
    [self addSubview:popupView];

    [UIView animateWithDuration:0.12 delay:0.0 options:UIViewAnimationOptionCurveEaseOut|UIViewAnimationOptionLayoutSubviews animations:^(void) {
        popupView.frame = CGRectMake(-pw*0.55+8, -ph*1.1-2, pw*1.1, ph*1.1);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.1 delay:0.0 options:UIViewAnimationOptionLayoutSubviews animations:^(void) {
            popupView.frame = CGRectMake(-pw*0.475+8, -ph*0.95-2, pw*0.95, ph*0.95);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.075 delay:0.0 options:UIViewAnimationOptionLayoutSubviews animations:^(void) {
                popupView.frame = CGRectMake(-round(pw/2-8), -ph-2, pw, ph);
            } completion:nil];
        }];
    }]; 
}

Bit of a complicated looking animation, but effectively this is the same animation as the mapview callout view animation.

Only thing is, it works perfectly on iOS 5 devices, but on iOS 4 devices, everything is wrong! The label doesn’t show at all, the button appears and then flies off shrinking into the top right hand corder, and the background image stretches to the wrong size and in the wrong place.

Anyone else had any problems with animations in iOS 4? Do I have to do things differently than how they are currently in order to get it to work?

  • 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-27T06:37:55+00:00Added an answer on May 27, 2026 at 6:37 am

    (1) Are you doing manual layout in a UIView subclass’s layoutSubviews implemention? If not, you should not be using UIViewAnimationOptionLayoutSubviews in your options bitmask. I don’t know if that’s the problem but there’s no point adding extra sources of possible error.

    (2) When in doubt, use Core Animation. You could describe your animation sequence very handily as a nice CAAnimationGroup.

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

Sidebar

Related Questions

I have created a table view and i am adding my custom uiview into
I have created a custom UIView that I would like to use on multiple
I have a custom UIViewController and custom UIView. I'd like to override the viewcontroller.view
I have created a UIScrollView (canvas.scrollview) and have a custom UIView (canvas) inside it.
I have a custom UIView class. Inside that view, there is an image view.
So I created a glass pane or a custom UIView to handle touches. This
I have a custom UIView subclass without a corresponding UIViewController. I use this class
I have created a custom subclass of UIView for an interface element that I
I have a custom view that subclasses UIView. It has a touchesEnded event, however
I have a custom UIButton added as subview to a UIView subclass. In my

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.