I'm currently using the JTCalendar calendar control to show a calendar grid on the top half of my view controller. Before I attempt to add a table, the calendar view takes up the top half, and the bottom half is empty.
After I add the code for the UITableView
, which I want to be displayed in the bottom half, the table is now taking up the entire view, rather than just fitting into the bottom half. I've set up the table view like so:
ViewController.h:
#import <UIKit/UIKit.h>
#import "JTCalendar.h"
@interface ViewController : UIViewController<JTCalendarDataSource, UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet JTCalendarMenuView *calendarMenuView;
@property (weak, nonatomic) IBOutlet JTCalendarContentView *calendarContentView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *calendarContentViewHeight;
@property (strong, nonatomic) JTCalendar *calendar;
@property (strong, nonatomic) NSArray *agendaTableArray;
@end
ViewController.m:
- (void)viewDidLoad
{
[super viewDidLoad];
self.calendar = [JTCalendar new];
// All modifications on calendarAppearance have to be done before setMenuMonthsView and setContentView
// Or you will have to call reloadAppearance
{
self.calendar.calendarAppearance.calendar.firstWeekday = 1;
self.calendar.calendarAppearance.dayCircleRatio = 9. / 10.;
self.calendar.calendarAppearance.ratioContentMenu = 1.;
}
////
// Initialize Day Agenda table
UITableView *agendaTable = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
agendaTable.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
agendaTable.delegate = self;
agendaTable.dataSource = self;
[agendaTable reloadData];
[self.view addSubview: agendaTable];
/////
[self.calendar setMenuMonthsView:self.calendarMenuView];
[self.calendar setContentView:self.calendarContentView];
[self.calendar setDataSource:self];
}
What's causing it to take up the entire view? I made sure to have it be a subview, but that doesn't seem to be working. Did I set up the table incorrectly in any way?