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

The Archive Base Latest Questions

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

I have a ViewController with 3 views: Rootview that shows toolbar with UISegmentedControl, tableView,

  • 0

I have a ViewController with 3 views: Rootview that shows toolbar with UISegmentedControl, tableView, and calendarView.

I have XIB for the rootView, and tableView, but the calendarView doesn’t have a XIB.

I need to somehow combine the code to load the calendar view to fit with with this ViewController. Before, I was using the calendarView as its own viewController.

The code for calendarView:

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
        calendar =  [[TKCalendarMonthView alloc] init];
        calendar.delegate = self;
        calendar.dataSource = self;
    }
    return self;
}

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView 
{
    UIBarButtonItem *actionButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(dismissCalendarView)];
    self.navigationItem.leftBarButtonItem = actionButton;
    [actionButton release];

    int statusBarHeight = 0;
    CGRect applicationFrame = (CGRect)[[UIScreen mainScreen] applicationFrame];
    self.view = [[[UIView alloc] initWithFrame:CGRectMake(0, statusBarHeight, applicationFrame.size.width, 300.0)] autorelease];
    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.view.backgroundColor = [UIColor clearColor];
    self.title = @"Select Workout";
    calendar.frame = CGRectMake(0, 0, calendar.frame.size.width, calendar.frame.size.height);
    NSLog(@"%f height", applicationFrame.size.height);
    [self.view addSubview:calendar];
    [calendar reload];
}

If I put that code directly into this new viewController, it does not respect the UISegmentedControl and just shows up at launch.

Here is the code for the UISegmentedConrol:

- (void)segmentedControl:(SVSegmentedControl*)segmentedControl didSelectIndex:(NSUInteger)index
{    
    switch (index) 
    {
        case 0: 
        {
            [self.view addSubview: tableView1];
            tableView1.hidden = NO;
            calendar.hidden = YES;
            [calendar removeFromSuperview];
            break;
        }
        case 1: 
        {
            [self.view addSubview: calendar];
            tableView1.hidden = YES;
            calendar.hidden = NO;
            [tableView1 removeFromSuperview];
            break;
        }
    }
}
  • 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:33:15+00:00Added an answer on May 23, 2026 at 10:33 am

    Does using two different init-Methods fit your needs? initWithNibName:@"nib1" or likewise initWithNibName:@"nib2"??
    Otherwise you will need to specify what you want to achieve a little more

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

Sidebar

Related Questions

I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
I have a ViewController that manages a view full of controls, including UITextView s,
I have a couple of modal views that have been working just fine and
I have a number of viewControllers (iPad) that manage different views presenting various screens
I have a view controller class that has to implement several protocols. Too keep
I have a view controller that gets presented modally and changes some data that
Example: I have a view controller and get rid of it. But there's still
I'm tinkering with an iPad app that (like many iPad apps) doesn't use the
I have created the view controllers and attached those to control their respective views.
I have an Action Sheet that is called from my root view controller using

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.