mardi 4 août 2015

UIPopoverPresentationController Arrow not pointing to Rect

I'm trying to implement a UIPopoverPresentationController and I'm running into this problem where the arrow doesn't point to the sourceRect when it's near the screen's bounds. How can I configure this so the arrow points to the rect instead of above it?

For example:

enter image description here

Thanks!

EDIT: Sorry for lack of information. I'm working on iOS 8 and testing on iPhone 6 as of right now.

In the picture above, I had attached a white colored UIView to see what the sourceRect looked like on the screen.

The code I'm using:

    // contentView is custom UIViewController
    contentView.preferredContentSize = CGSizeMake(250, 100);

    contentView.modalPresentationStyle = UIModalPresentationPopover;
    UIPopoverPresentationController *popover = contentView.popoverPresentationController;
    popover.delegate = self;
    popover.permittedArrowDirections = UIPopoverArrowDirectionLeft;
    popover.sourceView = self.imageView;
    popover.sourceRect = CGRectMake(78, 28, 95, 5);
    [self presentViewController:contentView animated:YES completion:nil];



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire