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