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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:03:36+00:00 2026-05-25T11:03:36+00:00

I have an interface like this: @interface AView : UIScrollView { UIView* m_view1; UIView*

  • 0

I have an interface like this:

@interface AView : UIScrollView
{
    UIView* m_view1;
    UIView* m_view2;
    ...
}

-(void) method1;
-(void) method2;
...
@end

I need to access views from methods of the interface. I need to create, release, re-create them and also set properties.

The problem is, some methods of the interface are running in different threads. Since these methods access same views I have issues like one thread trying to re-create a view when another thread is trying to set some properties of a view being recreated.

How should I synchronize access to views?

  • 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-25T11:03:37+00:00Added an answer on May 25, 2026 at 11:03 am

    First of all, do you know you can ONLY call the methods of the UIView class (and it’s subclasses) in the main thread? But, if you are just doing create and release job in second thread, it’s OK to do it.

    Threading Considerations

    Manipulations to your application’s user interface must occur on the
    main thread. Thus, you should always call the methods of the UIView
    class from code running in the main thread of your application. The
    only time this may not be strictly necessary is when creating the view
    object itself; but all other manipulations should occur on the main
    thread.

    In addition, you can use @synchronized() {object} to lock an object. But still, you can NOT call UIView’s methods in second thread (in Objective-C even set property is calling method) even you’ve locked it.

    Objective-C supports multithreading in applications. Therefore, two
    threads can try to modify the same object at the same time, a
    situation that can cause serious problems in a program. To protect
    sections of code from being executed by more than one thread at a
    time, Objective-C provides the @synchronized() directive.

    The @synchronized()directive locks a section of code for use by a
    single thread. Other threads are blocked until the thread exits the
    protected code—that is, when execution continues past the last
    statement in the @synchronized() block.

    The @synchronized() directive takes as its only argument any
    Objective-C object, including self.

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

Sidebar

Related Questions

I have an interface definded like this: public interface IDatabase{ void Get<TTypeToFetch> ();} and
I have a interface member like this. AppInterface.cs ObjLocation[] ArrayLocations { get; } App.cs
I have a method on an interface that looks like this and I want
I have a scene, called testScene, it works like this: @interface testScene : myScene
Let's say I have a class that implements the IDisposable interface. Something like this:
I have a XIB set up like in this screenshot: alt text http://emberapp.com/jxpx777/images/interface-builder/sizes/m.png File's
Here goes: I have a view that looks like this: public interface IAddressView {
Does dot net have an interface like IEnumerable with a count property? I know
I cannot find a dictionary entry by key. I have an interface like the
I'd like to have one interface for all my grid related tasks.The tasks implement

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.