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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:20:07+00:00 2026-06-02T08:20:07+00:00

//viewcontroller.m -(void)viewdidLoad { self.theOneViewController= [[TheOneViewController alloc]init]; [contentsView addSubview:self.theOneViewController.view]; } //theOneViewController – (void)viewDidLoad { .

  • 0
//viewcontroller.m

-(void)viewdidLoad
{
   self.theOneViewController= [[TheOneViewController alloc]init];
  [contentsView addSubview:self.theOneViewController.view];
}


//theOneViewController

- (void)viewDidLoad
{          .
           .
           .
       //UI WORK
           .
           .
    //LONG WORK  
[self performSelectorOnMainThread:@selector(initAppList) withObject:nil waitUntilDone:NO]; 

}

this code, view display UI WORK before LONG WORK is end.So I can have a thread effect.

//viewcontroller.m

-(void) buttonPressed:(id)sender    -> event method
{
 self.theOneViewController= [[TheOneViewController alloc]init];
 [contentsView addSubview:self.theOneViewController.view];
}

 //theOneViewController
 - (void)viewDidLoad
 {         .
           .
           .
      //UI WORK
           .
           .
  //LONG WORK 
  [self performSelectorOnMainThread:@selector(initAppList) withObject:nil waitUntilDone:NO]; 
 }

In this code, view display UI WORK after LONG WORK is end.
So I can’t have thread effect. why?
And I use (performSelectorInBackground:withObject:) instead of (performSelectorOnMainThread withObject:waitUntilDone:) . but this is slower than not using thread.

I want to have thread effect in event method call.
Is there a good way? help me please!

  • 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-02T08:20:09+00:00Added an answer on June 2, 2026 at 8:20 am

    Your question isn’t particularly clear but I’ll have a go at answering.

    You are calling performSelectorOnMainThread:withObject:waitUntilDone: from either your viewDidLoad or buttonPressed methods. The problem with this is that all UI handling (viewDidLoad, UI events etc) is done on the main thread which means that calling performSelectorOnMainThread will just queue the method on the main threads runloop. This probably means that the method will run immediately after the calling method completes.

    Ultimately, you aren’t really gaining much by doing this over just calling the method directly as the main thread will take about the same amount of time to do either way.

    Calling performSelectorOnBackgroundThread:withObject: will run the initAppList method on a separate thread, allowing the main thread to continue dealing with the UI. However, as you note, that will probably be a little bit slower overall as there is the overhead of creating the background thread.

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

Sidebar

Related Questions

How to perform a [self.view addSubview: lbl] outside of ViewController Class scope ? or:
This is my code in my viewcontroller.m file - (void)viewDidLoad{ [super viewDidLoad]; [self.abilitygeneration setText:((TestAbility
It is in My view controller -(void)doctorsListAction { if(isFirst == YES) { [self getDoctorsListController];
here's my code: ViewController *vc = [[ViewController alloc] initWithNibName:@TableView bundle:nil]; [self.navigationController presentModalViewController:vc animated:YES]; //[self
I use the following code to add cocos2d scene to a viewcontroller - (void)viewDidLoad
My button won't display. Does anyone know why? #import ViewController.h @implementation ViewController - (void)viewDidLoad
I have following coding in my ViewDidLoad of ViewController - (void)viewDidLoad { [super viewDidLoad];
Given the UINavigationController delegate methods: -(void)navigationController:(UINavigationController*)navigationController (will/did)ShowViewController:(UIViewController*)viewController animated:(BOOL)animated How do you tell or compare
I have the following view controller in my UIPopover: @protocol StorePopoverDelegate - (void)storeSelected:(NSString *)store;
If ViewController 's view is set to MyView And ViewController maintains a pointer to

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.