views:

152

answers:

1

Im trying to make my own calendar similar to iCal and all is going well except for one thing. I plan to have the calendar selection up the top then a table list down the bottom. I can do this but then the calendar is in the same subview as the table and scrolls with it. Although I am currently not using a nib if I build it in a nib then the table wont resize to take up whatever the calendar doesn't. ie it should be larger in say February where as December will be small (exactly like the apple iCal version) I have seen other apps do this. Any ideas on how I would go about this?

+1  A: 

Add the tableview and the calendar view separately to the main view.

Example:

- (void)loadView {
    [super loadView];

    UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
    topView.backgroundColor = [UIColor darkGrayColor];

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 280, 60)];
    label.text = @"Stationary top view";
    label.textColor = [UIColor whiteColor];
    label.backgroundColor = [UIColor clearColor];
    label.textAlignment = UITextAlignmentCenter;
    [topView addSubview:label];
    [label release];


    [self.view addSubview:topView];
    [topView release];


    UITableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 100, 320, 380) style:UITableViewStyleGrouped];
    tableview.delegate = self;
    tableview.dataSource = self;
    [self.view addSubview:tableview];
    [tableview release];
}

Screenshot:

alt text

bentford