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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:40:15+00:00 2026-05-23T10:40:15+00:00

Ok, so bear with me: as this is an Objective-C related question, there’s obviously

  • 0

Ok, so bear with me: as this is an Objective-C related question, there’s obviously a lot of code and subclassing. So here’s my issue. Right now, I’ve got an iPad app that programmatically creates a button and two colored UIViews. These colored UIViews are controlled by SubViewControllers, and the entire thing is in a UIView controlled by a MainViewController. (i.e. MainViewController = [UIButton, SubViewController, SubViewController])

Now, all of this happens as it should, and I end up with what I expect (below):

viewtools

However, when I click the button, and the console shows “flipSubView1”, nothing happens. No modal view gets shown, and no errors occur. Just nothing. What I expect is that either subView1 or the entire view will flip horizontally and show subView3. Is there some code that I’m missing that would cause that to happen / is there some bug that I’m overlooking?

viewtoolsAppDelegate.m

@implementation viewtoolsAppDelegate

@synthesize window = _window;
@synthesize mvc;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    mvc = [[MainViewController alloc] initWithFrame:self.window.frame];
    [self.window addSubview:mvc.theView];
    [self.window makeKeyAndVisible];

    return YES;
}

MainViewController.m

@implementation MainViewController

@synthesize theView;
@synthesize subView1, subView2, subView3;

- (id)initWithFrame:(CGRect) frame
{
    theView = [[UIView alloc] initWithFrame:frame];
    CGRect sV1Rect = CGRectMake(frame.origin.x+44, frame.origin.y, frame.size.width-44, frame.size.height/2);
    CGRect sV2Rect = CGRectMake(frame.origin.x+44, frame.origin.y+frame.size.height/2, frame.size.width-44, frame.size.height/2);
    subView1 = [[SubViewController alloc] initWithFrame:sV1Rect andColor:[UIColor blueColor]];
    subView2 = [[SubViewController alloc] initWithFrame:sV2Rect andColor:[UIColor greenColor]];
    subView3 = [[SubViewController alloc] initWithFrame:sV1Rect andColor:[UIColor redColor]];
    [theView addSubview:subView1.theView];
    [theView addSubview:subView2.theView];

    UIButton *aButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [aButton addTarget:self action:@selector(flipSubView1:) forControlEvents:(UIControlEvents)UIControlEventTouchDown];
    [aButton setFrame:CGRectMake(0, 0, 44, frame.size.height)];
    [theView addSubview:aButton];

    return self;
}

- (void)flipSubView1:(id) sender
{
    NSLog(@"flipSubView1");
    [subView3 setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    [subView1 presentModalViewController:subView3 animated:YES];
}

SubViewController.m

@implementation SubViewController

@synthesize theView;

- (id)initWithFrame:(CGRect)frame andColor:(UIColor *)color
{
    theView = [[UIView alloc] initWithFrame:frame];
    theView.backgroundColor = color;
    return self;
}

TLDR: modal view not working. should see flip. don’t.

  • 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-23T10:40:16+00:00Added an answer on May 23, 2026 at 10:40 am

    It doesn’t look like you’re setting the ‘view’ property of the MainViewController anywhere, just ‘theView’. The controllers view delegate must be connected to the root view it displays for it to work properly. You’ll need to correct that on the Sub View Controller impl as well. If you want all the plumbing that framework classes bring, you have to set things up the way they expect.

    Also, you’re calling presentModalViewController on one of the sub view controllers; change that to call [self presentModalViewController:…], since the MainViewController is the one which will ‘own’ the modal view.

    I think if you fix those points, you’ll find -presentModalViewController will work.

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

Sidebar

Related Questions

This question is from an Objective-C newbie, so please bear with me. I'm trying
Please bear with me if this isn't clear, this is my first posting here.
this is my first time asking a question so bear with me. I am
This is not really a programming question but please bear with me as I
First, I am super-new to Objective-C/iOS development and, in fact, this question is for
I'm a total newbie at Objective-C, so bear with me. This is how I'm
I'm new to Lua so please bear with this simple question :) I'm simply
I know there have been plenty of variations on this question before, but none
Please bear with me if this question isn't well formulated. Not knowing is part
This is a pretty strange issue so bear with me. I have a stored

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.