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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:29:27+00:00 2026-06-10T09:29:27+00:00

I use xcode 4.4 with ARC on. I have dynamically created UIViews in the

  • 0

I use xcode 4.4 with ARC on. I have dynamically created UIViews in the ViewController.m:

UIView* myviews[10];

Then in the – (void)viewDidLoad function i fill each of it with pictures i need

myviews[viewIndex] = [[UIView alloc]initWithFrame:myrec];
UIImage *testImg;
UIImageView * testImgView = [[UIImageView alloc]init];
testImg = [UIImage imageNamed:[NSString stringWithFormat:@"imgarray%d.png", viewIndex];
[testImgView setImage:testImg];
[myviews[viewIndex] addsubView:testImgView];
viewindex++;

So all seems to be fine, when i want to jump from one view to another i do with two buttons next:

[self.view addSubview:views[viewIndex]];
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
[animation setType:@"rippleEffect"];
[animation setSubtype:kCATransitionFromTop];
//[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[self.view.layer addAnimation:animation forKey:@"transitionViewAnimation"];

Nothing seems to be bad, but the memory consumption grows with huge speed when i switch between views.. and then i get low memory warning or sometimes application will just crash.

I have tried to use UIViewController array and was switching between the controllers: nothing changes, the memory low warning is what i end up with..

Maybe i need to clean the memory somehow? But how? ARC does not allow to use release and so on..

last what i have tried (sorry, maybe not very professional) before to add new subview is this

NSArray *viewsToRemove = [self.view subviews];
                    for (UIView *views in viewsToRemove) {
                        [views removeFromSuperview];
                    }

But this does not help either.

EDIT: I need to clarify one thing: i need each UIView during the application execution, this means i can’t release it before the application exit.

EDIT2: code is edited to look more alike the real code.

  • 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-10T09:29:29+00:00Added an answer on June 10, 2026 at 9:29 am

    A few thoughts:

    First, something’s not right in the code as copied, as you never create testImgView. Instead of

    testImgView.image = testImg;
    

    you need

    testImgView = [UIImageView viewWithImage:image];
    

    Second, you don’t need to go into layer animation. See this code instead…

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition: 110 forView:view cache:NO];  //110 for ripple effect
    [UIView commitAnimations];
    

    Third, you could try just adding all your views in viewDidLoad with tags and then setting visible.

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

Sidebar

Related Questions

I have Xcode 4.3 and that class doesn't use ARC. I have created a
I am trying to use XMPPFramework with an iOS5 project (ARC) under xcode 4.2.1
I have a few doubts regarding the use of attributes. By reading the ARC
I created a project without ARC . I want to use a third party
I use xcode 4.2 and this use ARC (Automatic Reference Counting). This is not
I just installed XCode 4.2, according to to everything I have read ARC is
I just updated a project to make use of ARC with the Xcode 4.2
(Xcode 4.2, iOS 5, ARC ) I have some properties of Core Foundation (/Graphics)
I have an older app that does not use ARC. When trying to address
I use Xcode 4.2 for editing a rails app. If I open a file

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.