2016-08-27 5 views
0

UIViewControllerを作成しました。Interface Builderを使用すると、指定されたサイズのポップオーバーとしてUIViewControllerを表示できます。iphoneでポップオーバーとしてUIViewControllerを表示することは可能ですか

サイズクラスを使用しているので、私のUIViewControllerのサイズはデフォルトの600X600です。

私はさまざまな回答を利用しようとしましたが、どれも私にとってはうまくいきません。

+0

いいえ、コンテナレイアウトを試すことができます。 –

+0

これはあなたを助けるでしょうhttp://stackoverflow.com/a/38865881/6433023 –

+0

サードパーティのライブラリに依存する必要があるかもしれません。これはhttps://github.com/nicolaschengdev/WYPopoverControllerに役立ちます – Sreekanth

答えて

0

電話でポップオーバーを示すだけでUIPopoverControllerコードのカテゴリーください:

// UIPopoverController+iPhone.h 
     #import <UIKit/UIKit.h> 

     @interface UIPopoverController (iPhone) 
     + (BOOL)_popoversDisabled; 
     @end 
    // UIPopoverController+iPhone.m 


     #import "UIPopoverController+iPhone.h" 

     @implementation UIPopoverController (iPhone) 
     + (BOOL)_popoversDisabled { 
      return NO; 
     } 
     @end 

をし、ちょうどあなたが必要なこのカテゴリをインポートします。あなたがiPADに示すようにポップオーバーを表示します。

-(IBAction)showPopOver:(id)sender { 
TestPopOver *tstPop = [self.storyboard instantiateViewControllerWithIdentifier:@"TestPopOver"]; 
    popOverController = [[UIPopoverController alloc]initWithContentViewController:tstPop]; 
    popOverController.popoverContentSize = CGSizeMake(300.0, 300.0); 
    [popOverController presentPopoverFromRect:[(UIButton *)sender frame] 
              inView:self.view 
         permittedArrowDirections:UIPopoverArrowDirectionAny 
             animated:YES]; } 
関連する問題