Amit Nalawade
Amit Nalawade

Reputation: 31

Tableview not able to see all rows

I have a view where a calendar takes up the top half of the view and a tableview takes up the second half. I added both of these progmatically. It is a leave/vacation application wherein user submits leave requests from calendar and it appears as a row in the tableview. The problem is if the user goes on submitting leave requests I am not able to see bottom rows of table view and click on them. I tried putting a scroll view but to no use. How should I go about this?

// calendar view instance

calendarView = [[[KLCalendarView alloc] initWithFrame:CGRectMake(0.0f, 50.0f,  768.0f, 1024) delegate:self] autorelease];

//tableview instance

myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,690,768,1024) style:UITableViewStyleGrouped];

// add to main view

[self.view addSubview:calendarView];
[self.view addSubview:myTableView];

[self.view bringSubviewToFront:myTableView];

Upvotes: 0

Views: 117

Answers (4)

Vignesh
Vignesh

Reputation: 10251

The problem is your tableview frame. Find what is the available space you have in both orientation and set it for the tableview. It will solve your problem.

Upvotes: 1

Antonio MG
Antonio MG

Reputation: 20410

You have to set the contentSize of the table to make it scrollable, in case the total size is bigger than the frame you put in initWithFrame.

Try setting this:

myTableView.contentSize = CGSizeMake (x, y)

Where y can be the TOTAL height of your table

Upvotes: 0

matzino
matzino

Reputation: 3564

You init both Views (Calendar and Table) with the sizes 768 x 1024! You dont have an display that show 768 x 2048 px! Reduce the size of both Views to the max (iPhone/iPad)-Height / 2. Than you should see all Views complete.

Upvotes: 1

unexpectedvalue
unexpectedvalue

Reputation: 6139

I suppose this is iPad targeted. The 4th parameter to CGRectMake is height. Try doing

CGRectMake(0,690,768,1024-690)

Same with the calendar view.

Upvotes: 0

Related Questions