状态栏和模态视图之间的差距

时间:2012-01-10 20:08:11

标签: iphone

为什么状态栏和模态视图之间存在差距?有人可以帮助我解决状态栏和模态视图之间的差距。

 UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoLight];

[button addTarget:self action:@selector(displayModalViewaction:) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *infoItem = [[UIBarButtonItem alloc] initWithCustomView:button];


  - (void)displayModalViewaction: (id) sender 
    {

self.viewController = [[Infoviewcontroller alloc] init];

UINavigationController *navigationController=[[UINavigationController alloc] init];

navigationController.navigationBar.tintColor = [UIColor brownColor];  

[navigationController pushViewController:_viewController animated:YES];

[self.view addSubview:navigationController.view];

  }

非常感谢您提前帮助我。

1 个答案:

答案 0 :(得分:1)

添加视图框大小

[self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

修正了状态栏和模态视图之间的差距。