Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to the documentation on UIPopoverController, when the popover is presented, it is presented on a special "window". Because of this, simply adding a subview to the popover view controller's content view controller is not sufficient to be able to drag a view outside of the popover view controller's view.</p> <p>The easiest solution here is to create your own window, add your drag-able view to the window when dragging occurs. Make the window visible for the duration of the drag/drop, and then release your window when complete.</p> <p>As mentioned above, gesture recognizers (GR) are best suited for Drag/Drop functionality. Once the GR's state has changed to "Began" the GR will control all touches until the "Ended" or "Cancelled" state is achieved which makes it ideal for dragging views between view controllers as well as windows :)</p> <p>Example:</p> <pre><code>@interface MySplitViewController : UISplitViewController { UIView *dragView; UIWindow *dragWindow; } </code></pre> <p>Implementation: <strong><em>NOTE</em></strong> we do not need to call "makeKeyAndVisible" on our window. We just need to set its "Hidden" property</p> <p>From Apple in regards to the makeKeyAndVisible method: // convenience. most apps call this to show the main window and also make it key. otherwise use view hidden property</p> <pre><code>-(void)dragBegan{ self.dragWindow = [[UIWindow alloc] initWithFrame:self.view.window.frame]; [self.dragWindow addSubview:self.dragView]; [self.dragWindow setHidden:NO]; } </code></pre> <p>Here we handle the Gesture Recognizer's "Ended" or "Cancelled" state. <strong>NOTE</strong>: It is important to remove the window when the Drag/Drop is complete or you will lose user interactiveness with the views below.</p> <pre><code>-(void)dragEnded{ [self.dragView removeFromSuperview]; [self.dragWindow setHidden:YES]; [self.dragWindow release]; [self.view addSubview:self.dragView]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload