It looks like you're new here. If you want to get involved, click one of these buttons!
//Add the table view //initWithFrame:CGRectMake(0.0f, 44.0f, 320.0f, 436.0f) ];
UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight);
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
tableView.delegate = self;
tableView.dataSource = self;
self.view = tableView;
//[self.navigationController.view addSubview:tableView];
[tableView release];
//Initialize the toolbar
toolbar = [[UIToolbar alloc] init];
toolbar.barStyle = UIBarStyleDefault;
//Set the toolbar to fit the width of the app.
[toolbar sizeToFit];
//Caclulate the height of the toolbar
CGFloat toolbarHeight = [toolbar frame].size.height;
//Get the bounds of the parent view
CGRect rootViewBounds = self.parentViewController.view.bounds;
//Get the height of the parent view.
CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds);
//Get the width of the parent view,
CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds);
//Create a rectangle for the toolbar
CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight);
//Reposition and resize the receiver
[toolbar setFrame:rectArea];
//Add the toolbar as a subview to the navigation controller.
[self.navigationController.view addSubview:toolbar];
Replies
This successfully positions the toolbar and tableview so they dont overlap. However, at startup the toolbar covers the last cell in the tableview, but when I transitition to landscape, then back to portrait, it is corrected!
I have changed the frame of the tableview in loadview to CGRectMake(0.0, 0.0, 480.0, 236.0), but it doesnt help. How could I correct this?
- Spam
- Abuse
- Troll
0 · Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 · Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 · Off Topic Insightful Disagree Dislike Like Awesome