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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:47:01+00:00 2026-05-22T22:47:01+00:00

i have some UIViews,and there are some buttons on the first UIView,the click function

  • 0

i have some UIViews,and there are some buttons on the first UIView,the click function of them likes this

-(IBAction)securityClicked:(id)sender
{ 

SwitchViewController* switchViewController = (SwitchViewController*)[wangfan_chevyAppDelegate App].viewController;
[switchViewController.wtccviewcontroller.scrollView1 setContentOffset:CGPointMake(
                            1024*0, 0) animated:false];
[[testAppDelegate App] pushViewFromRight:switchViewController.wtccviewcontroller
                                            over:self];

}

and the wtccviewcontroller.m file’s code is

- (void)viewDidLoad {
[super viewDidLoad];    

UIViewController* controller = nil;

controller = [[Wtcc1ViewController alloc]initWithNibName:@"Wtcc1ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*0, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Wtcc2ViewController alloc]initWithNibName:@"Wtcc2ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*1, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Wtcc3ViewController alloc]initWithNibName:@"Wtcc3ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*2, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Wtcc4ViewController alloc]initWithNibName:@"Wtcc4ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*3, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[SecurityViewController alloc]initWithNibName:@"SecurityViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*4, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Security2ViewController alloc]initWithNibName:@"Security2ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*5, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Onstar1ViewController alloc]initWithNibName:@"Onstar1ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*6, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Movie1ViewController alloc]initWithNibName:@"Movie1ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*7, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[CarownerViewController alloc]initWithNibName:@"CarownerView" bundle:nil];
controller.view.frame = CGRectMake(1024*8, 0, 1024, 768);
[scrollView1 addSubview:controller.view];   
//[controller release];

controller = [[Co01ViewController alloc]initWithNibName:@"Co01ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*9, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[Co02ViewController alloc]initWithNibName:@"Co02ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*10, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[Co03ViewController alloc]initWithNibName:@"Co03ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*11, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[Co04ViewController alloc]initWithNibName:@"Co04ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*12, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[Co05ViewController alloc]initWithNibName:@"Co05ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*13, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[Co06ViewController alloc]initWithNibName:@"Co06ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*14, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[Co07ViewController alloc]initWithNibName:@"Co07ViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*15, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

controller = [[ConfigViewController alloc]initWithNibName:@"ConfigViewController" bundle:nil];
controller.view.frame = CGRectMake(1024*16, 0, 1024, 768);
[scrollView1 addSubview:controller.view];

    [scrollView1 setContentSize:CGSizeMake(1024*17,768)];
   }

because there are a lot of controllers,so when i click the button on the first view,it will be loaded so long,even quit the app,so how should i do for make it running well?

  • 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-22T22:47:02+00:00Added an answer on May 22, 2026 at 10:47 pm

    First of all, if you call [alloc] you create an object (for each controller) then you must release it. You can do this after adding the subview since this retains it.

    I see you commented out the [controller release] some times and then totally forgot about it.

    Also you’re adding a lot of controllers here. You could add the first in viewDidLoad and load lazily each other controller only when clicked.

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

Sidebar

Related Questions

I have a subclass s of UIView. I want to put some buttons and
I have some classes layed out like this class A { public virtual void
I have some code like this in a winforms app I was writing to
I have an UIView where I was drawing some stuff inside -drawRect:. Now I
Suppose I have a UIViewController subclass that takes care of some UIViews. These UIViews
I have a method that is performing some arithmetic on a set of UIViews
I have some UI in VB 2005 that looks great in XP Style, but
I have some ASP.NET web services which all share a common helper class they
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
We have some input data that sometimes appears with &nbsp characters on the end.

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.