You need to create your transparent view and then add it as a subtask to the view controller so that it is a native UITableView . You would do this in the viewDidLoad() method.
- (void)viewDidLoad { int viewHeight = 50; // Assume myTableView is a UITableView variable myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 44) style:UITableViewStylePlain]; myTableView.scrollIndicatorInsets = UIEdgeInsetsMake(viewHeight, 0, 0, 0); myTableView.contentInset = UIEdgeInsetsMake(viewHeight, 0, 0, 0); UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,viewHeight)]; // Configure your view here. myView.backgroundColor = [UIColor colorWithRed:0.0 green:0.7 blue:0.8 alpha:0.75]; [self.view addSubview:myTableView]; [self.view addSubview:myView]; [myView release]; }
You can also customize your presentation using XIB, but I will leave this as an exercise for you.
Edit: The requirement for UITableView delegation methods and a custom header using the contentInset property has been contentInset .
Note: see additional comments below.
Ben
source share