I'm really struggling to understand the CGRectMake. I understand its the position of the start and size of the rectangle, but i keep seeing examples where the X and Y positioning are always 0,0 . When i would expect different objects on a view to be positioned differently all all over screen ?. sorry if this is pretty basic stuff. The example beneath is has a header and footer sections both positioned at X0 and Y0 ,when i would have thought the footer would be down the screen with a higher Y value?
are the numbers relative to the view that contains the object ?, even so, i still don't really get it?
please help
are the numbers relative to the view that contains the object ?, even so, i still don't really get it?
please help
Code:
// setup our table data
self.tableArray = [NSArray arrayWithObjects:@"Camping", @"Water Skiing", @"Weight Lifting", @"Stamp Collecting", nil];
// set up the table's header view based on our UIView 'myHeaderView' outlet
CGRect newFrame = CGRectMake(0.0, 0.0, self.tableView.bounds.size.width, self.myHeaderView.frame.size.height);
self.myHeaderView.backgroundColor = [UIColor clearColor];
self.myHeaderView.frame = newFrame;
self.tableView.tableHeaderView = self.myHeaderView; // note this will override UITableView's 'sectionHeaderHeight' property
// set up the table's footer view based on our UIView 'myFooterView' outlet
newFrame = CGRectMake(0.0, 0.0, self.tableView.bounds.size.width, self.myFooterView.frame.size.height);
self.myFooterView.backgroundColor = [UIColor clearColor];
self.myFooterView.frame = newFrame;
self.tableView.tableFooterView = self.myFooterView; // note this will override UITableView's 'sectionFooterHeight' property
Last edited by a moderator: