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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:22:19+00:00 2026-06-03T12:22:19+00:00

i want to learn GCD on my own app-project and i’ve got problem with

  • 0

i want to learn GCD on my own app-project and i’ve got problem with it. i think is easy but i don’t know how solve it. so i’ve got 2 methods:

- (void)viewDidLoad
{

[super viewDidLoad];

queue = dispatch_queue_create("com.fe.effect.load", NULL);

__block UIImage *th;

dispatch_sync(queue, ^{
    th = [self doThumbWithImage:thumbnail andTag:1];
    UIButton *btn1 = [self buttonWithFrame:CGRectMake(0, 0, 200, 100) andBackgroundImage:th andSelector:@selector(doEffect:) andTag:1];
    [self.view addSubview:btn1];
});


dispatch_sync(queue, ^{
    th = [self doThumbWithImage:thumbnail andTag:2];
    UIButton *btn2 = [self buttonWithFrame:CGRectMake(0, 100, 200, 100) andBackgroundImage:th andSelector:@selector(doEffect:) andTag:2];
    [self.view addSubview:btn2];
});

}

and 2 method:

-(UIImage *)doThumbWithImage:(UIImage *)_img andTag:(int)_tag {

ImageProcessing *ip = [[ImageProcessing alloc] initWithImage:_img andTag:_tag];
[ip doImageProcessing];
_img = ip.image;
ip = nil;    

return _img;

}

And in doThumbWithImage:andTag: i’ve got ImageProcessing class where i do something with my thumbnail object.

when i use dispatch_sync, time for this operation is the same as without GCD. When i use dispatch_async, i can’t see thumbanils of buttons. I know something is wrong, but i don’t know what.

How can i repair this?

thank you for help.

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

    You probably need to do the addSubview in the main thread. You can nest the dispatch_async calls to handle that.

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

Sidebar

Related Questions

I want to learn some JVM language, but there are so many EDIT :
I want to learn WPF but from all the commentary I've been hearing the
still on regex! i want learn it but i'm still crashing the head into
I want to learn a functional language and Mnesia seems killer app enough for
I want to learn MSCharts in asp.net. Please suggest some good and easy online
i want to learn it! please if you know good videos, post links. Want
I want to learn APL (more specifically Dyalog APL), but I can't seem to
I want to learn the pros and cons of using Web Site project type
i want to learn C++; and i already have a compiler. i already know
I got a huge PostgreSQL database with lots of tables. I want learn all

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.