0
我有一个NavBar和ToolBar的简单项目。我的代码:解除模态视图控制器后查看上升
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor whiteColor]];
[toolBar setBarStyle:UIBarStyleBlack];
[toolBar setTranslucent:YES];
addPhotoItem = [[UIBarButtonItem alloc] initWithTitle:@"Add photo" style:UIBarButtonItemStyleBordered target:self action:@selector(showActionSheet)];
NSArray *itemsArray = @[ addPhotoItem ];
[toolBar setItems:itemsArray];
[toolBar setFrame:CGRectMake(0.0f, self.view.frame.size.height-44.0f, self.view.frame.size.width, 44.0f)];
[self.view addSubview:toolBar];
[navBar setFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 44.0f)];
[navBar setBarStyle:UIBarStyleBlack];
[navBar setTranslucent:YES];
[self.view addSubview:navBar];
}
在我的工具栏中我有一个按钮,可以打开2个选项的ActionSheet:从相机和库中获取图像。我的代码:
- (void)getMediaFromSource:(UIImagePickerControllerSourceType)sourceType {
self.imagePicker.delegate = self;
self.imagePicker.sourceType = sourceType;
[self presentModalViewController:self.imagePicker animated:YES];
}
但驳回模态控制器后,我的父视图上升为44pt(约)。我该如何解决这个问题?
即使我没有使用UINavigationController应用程序,我可以这样做吗? – RomanHouse
不,它只存在于UINavigationController的情况下,你提到你有一个navBar。 –
我有navBar,但我自己添加它 – RomanHouse