开发者

can't set tableview frame in landscape, parameters set but view is strange [screenshot attached]

开发者 https://www.devze.com 2023-03-04 23:19 出处:网络
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.

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];

can't set tableview frame in landscape, parameters set but view is strange [screenshot attached]


I found a workaround to this problem by creating a container UIView with my intended frame and add the tableview to its subview.

0

精彩评论

暂无评论...
验证码 换一张
取 消