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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:59:39+00:00 2026-06-17T09:59:39+00:00

I want to stack a UIViewController Board on top of a UIViewController Menu in

  • 0

I want to stack a UIViewController Board on top of a UIViewController Menu in order to create a Facebook-like side menu. This menu should contain a UITextView.

So far I can drag the Board View side ways and the Menu appears underneath it. Great. But there’s an issue with the UITextView inside the menu. When I click it the app crashes with a BAD_EXC… exception. It seems like an issue with the UITextView Delegate.

Here’s how I currently set it.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    //Board
    board = [[BoardViewController alloc] init];
    [self.window setRootViewController:board];

    //Menu
    MenuViewController* menu = [[MenuViewController alloc]init];
    menu.textView.delegate = menu;
    [self.window addSubview:menu.view];

    //Window
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

Note: when I set the textView delegate to board and implement the delegate methods there it works but that really seems to be the wrong place to implement the menu textview methods to me. The delegate of the menu should be in the menu class itself.

How to set the menu’s textView delegate correctly to the menu class?

  • 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-17T09:59:40+00:00Added an answer on June 17, 2026 at 9:59 am
    //Menu
    MenuViewController* menu = [[MenuViewController alloc]init];
    menu.textView.delegate = menu;
    [self.window addSubview:menu.view];
    

    And then, poof: the menu view controller isn’t referenced again and is deallocated by ARC. The view is retained by the window so it will look like everything is ok until the text view tries to send its delegate message to an object which was long since deallocated. This is the cause of your EXC_BAD_ACCESS crash.

    The simple, slack solution would be to define a property in your app delegate for the menu view controller.

    @property (nonatomic, strong) MenuViewController * menu;
    

    and then store the menu there

    //MenuViewController* menu = [[MenuViewController alloc]init];
    //becomes
    self.menu = [[MenuViewController alloc]init];
    

    The proper solution and the one I recommend is that you look up UIViewController containment and implement your own custom view controller container that looks after this special arrangement of view controllers.

    Just to briefly outline: You would have a subclass of UIViewController with two properties, one for the board view controller and one for the menu view controller. It would have a scroll view and would be responsible for the sliding action and any communication that needed to be passed from the board to the menu and vis versa. This container would also be responsible for loading the board and the menu view controllers and inserting their views into the correct places in its own view. If the board view controller needs to be swapped out for another board then the container would be responsible for this also.

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

Sidebar

Related Questions

I want to create a widget like Stack Overflow Tag Field. How to add
I want to create a DashBoard in my Application like that https://i.stack.imgur.com/uDwlf.png . The
I want to stack this type of my data set: PATIENT_ID AA BB CC
i'd like to stack two UITableViews in a single view. i can do this
I want to stack one division on top of another each with different background.
I have lots of details. I want to stack them within an array, can
I want to retrieve stack trace from a user dump file programmatically . There
Similar Stack Overflow Question I want users to be able to search through my
I want to disable the stack trace getting generated when an exception is thrown.
I want to get a detailed log about my stack trace. I can get

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.