can't set tableview frame in landscape, parameters set but view is strange [screenshot attached]
I try to set the frame of a UITableView to (190,0,610,768) in landscape mode. The frame parameters are correctly set but display is not correct.
To contrast the result, I added a UIlabel with same frame to 开发者_开发问答the bottom:
CGRect frame = CGRectMake(190, 0, 610, 768);
UILabel *lbtb = [[UILabel alloc] initWithFrame:frame];
lbtb.backgroundColor = [UIColor cyanColor];
lbtb.text = @"";
[self.view addSubview:lbtb];
dishMenuVC = [[DishMenuViewController alloc] init] ;
dishMenuVC.view.frame = frame;
dishMenuVC.view.backgroundColor = [UIColor redColor];
dishMenuVC.view.alpha = 0.5;
[self.view addSubview:dishMenuVC.view];
I found a workaround to this problem by creating a container UIView with my intended frame and add the tableview to its subview.
精彩评论