2016-04-17 9 views
1

iPhoneでUIPopoverPresentationControllerクラスでポップオーバーを表示しようとしています。 私は、ポップオーバーの内部にナビゲーションコントローラを提示する必要があります。だから私は次のようにします:UIPopoverPresentationControllerは矢印の色を設定できません

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 
    viewController.preferredContentSize = size; 
    navigationController.modalPresentationStyle = UIModalPresentationPopover; 
    self.currentPopoverController = navigationController.popoverPresentationController; 
    self.currentPopoverController.backgroundColor = [UIColor commonApplicationBgColor];//My common app blue color 
    self.view.alpha = 0.7; 
    [self presentViewController:navigationController animated:YES completion:nil]; 

矢印の色は、ポップオーバーナビゲーションバーの背景色とは異なります。私は彼らが同じ[UIColor commonApplicationBgColor]を使用していることを確認しましたが、矢印の色が暗いように見えます。 self.currentPopoverController.backgroundColorの設定アルファを試しましたが、それでも色は間違っています。 画像を確認してください:あなたは、矢印たくない場合 enter image description here

+0

あなたはRECTからそれを提示しているのに役立ちます

myPopoverViewController.modalPresentationStyle = UIModalPresentationPopover; [self presentViewController:myPopoverViewController animated: YES completion: nil]; // Get the popover presentation controller and configure it. UIPopoverPresentationController *presentationController = [myPopoverViewController popoverPresentationController]; presentationController.permittedArrowDirections = UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight; presentationController.sourceView = myView; presentationController.sourceRect = sourceRect; presentationController.backgroundColor = [UIColor grayColor]; //set your expacted color here. 

希望? – Lion

+0

はい、ここにコードがあります: self.currentPopoverController.delegate = self; self.currentPopoverController.sourceView = self.view; self.currentPopoverController.sourceRect = frame; iOSの7 Appleが独自のアプリケーションでは、非常に多くを使用していないと、これは結果であるので、 –

+0

ポップオーバーは非常に良好に動作しません。 – Sulthan

答えて

-1

はあなたのようなpermittedarrowdirectionに0を渡すことができ

[popoverController presentPopoverFromRect:YOUR_RECT 
           inView:self.view 
       permittedArrowDirections:0 
           animated:YES]; 

更新:

あなたのように設定することができ、

popover = [[UIPopoverController alloc] initWithContentViewController:contentViewController]; 
popover.backgroundColor = contentViewController.view.backgroundColor; 

popovercontrollerに背景色を設定します。

アップデート2:これは

+1

いいえ、私は矢印が必要です。問題はpopover arrowの背景色です。色はPopoverナビゲーションバーの色よりも暗いです。画像を確認してください。 –

+0

iPad版ですか?私のコードをしてくださいチェック、私は申し訳ありませんが、最初に私がiPadのpopoverControllerを理解しているpopoverPresentationController –

+0

を使用しています。私は自分の答えを更新した。 – Lion