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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:20:33+00:00 2026-06-17T05:20:33+00:00

I have a Main View Controller that has many subviews. What I want is

  • 0

I have a Main View Controller that has many subviews. What I want is to disable all other views except one subview and its subviews programmatically from the subview file. But all I get is all frozen views. What did I do wrong?

I tried this code:

#define kDontDisableUserInteraction 321


- (id)initWithFrame:(CGRect)frame
{
    NSLog(@"initWithFrame");
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.tag = kDontDisableUserInteraction;
    }
    return self;
}

-(void)something{

    MVC *myController = [self getMVC];

    for (UIView* subview in myController.view.subviews) {
        NSLog(@"subview.tag %i", subview.tag);
        if (subview.tag != kDontDisableUserInteraction){
            subview.userInteractionEnabled = NO;
        }
    }


    for (UIView *view in self.subviews){
        NSLog(@"enabled!");
        view.userInteractionEnabled = YES;
    }
}

- (MVC *)getMVC {
    Class vcc = [MVC class];    // Called here to avoid calling it iteratively unnecessarily.
    UIResponder *responder = self;
    while ((responder = [responder nextResponder])) if ([responder isKindOfClass: vcc]) return (MVC *)responder;
    return nil;
}
  • 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-17T05:20:34+00:00Added an answer on June 17, 2026 at 5:20 am

    I solved it by applying a full screen of a button on all other views and get the one view that I want to have user interaction upon the button. This way I disallow the user to click on any function except the one view I want the user to click on certain functions.

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

Sidebar

Related Questions

I have an application that has many views (Using tab bar controller). I want
I have a regular old iPhone app that has a main view controller that
I have a view controller controlling a main view with to sibling subviews. One
I have a view MainView that has a navigation bar without any navigation controller,
I have a main view controller that consists of 1 button that when tapped,
I have an app that has a main view that acts as a view
I have a main view and the URL for this view has a Action/Controller/Area
In my main view controller, I have a button that calls a popover. Since
I have a view controller and it has connected via xib. In that xib
I have a main view controller that takes care of the drawing for my

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.