Giter Site home page Giter Site logo

sammcewan / wypopovercontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nicolaschengdev/wypopovercontroller

252.0 27.0 74.0 2.73 MB

WYPopoverController is for the presentation of content in popover on iPhone / iPad devices. Very customizable.

License: Other

Ruby 0.52% Objective-C 99.48%

wypopovercontroller's People

Contributors

bgilham avatar blackpawn avatar bluezen avatar cbess avatar fdddf avatar gerasim13 avatar hsoi avatar ichernov avatar igrandav avatar jhersh avatar jinthagerman avatar joelfischerr avatar johankool avatar ksjun avatar littlepotatosoftware avatar maciekish avatar nicolaschengdev avatar nionguyen avatar pebble8888 avatar rayzordragon avatar readmecritic avatar rogerso avatar rrvieira avatar rsanchezsaez avatar sammcewan avatar scastria avatar shkutkov avatar tspacek avatar vitalys avatar wenchaod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wypopovercontroller's Issues

Resizing popover for different view controllers in the navigation stack?

My first view controller is quite small and has two rows in a table view. Later views in the navigation stack are much taller.

I don't want make the first one so big, I'd rather resize the popover as required.

I've tried setting preferredContentSize in viewWill appear and just before viewcontroller is added to the navigation stack. However it doesn't resize, until the next view controller is added to the navigation controller, I'm not sure why.

Can you tell me how to acheive this, or tell me it's not possible and that I'd have to set the popover at the larger size at the start?

Seeing as it does increase in height I expect it is possible, I'm just not sure where / how.

Thanks in advance.

Great job keeping this controller going :)

How do i change the content size of a popover without animation?

Hi,
I added a new method to my fork:

- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated
{
    popoverContentSize_ = size;
    [self positionPopover:animated];
}

However positionPopover: seems to be ignoring the animated property and the frame change of the popover background gets animated anyway. How do i do this properly?

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key ...

Any suggested fixes on this error ?

2016-10-08 22:03:36.304 MyApp[27679:296018] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x7fb0d15d9e50> (
< NSKeyValueObservance 0x7fb0d15cf460: Observer: 0x7fb0d15d5010, Key path: tintColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d5120>
< NSKeyValueObservance 0x7fb0d15d3c90: Observer: 0x7fb0d15d5010, Key path: outerStrokeColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d3c60>
< NSKeyValueObservance 0x7fb0d15d6760: Observer: 0x7fb0d15d5010, Key path: innerStrokeColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d6490>
< NSKeyValueObservance 0x7fb0d15d6c50: Observer: 0x7fb0d15d5010, Key path: fillTopColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d6b90>
< NSKeyValueObservance 0x7fb0d15d72c0: Observer: 0x7fb0d15d5010, Key path: fillBottomColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d64c0>
< NSKeyValueObservance 0x7fb0d15d7870: Observer: 0x7fb0d15d5010, Key path: glossShadowColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d4090>
< NSKeyValueObservance 0x7fb0d15d7d60: Observer: 0x7fb0d15d5010, Key path: glossShadowOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d7ca0>
< NSKeyValueObservance 0x7fb0d15d8340: Observer: 0x7fb0d15d5010, Key path: glossShadowBlurRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d8280>
< NSKeyValueObservance 0x7fb0d15d88d0: Observer: 0x7fb0d15d5010, Key path: borderWidth, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d87f0>
< NSKeyValueObservance 0x7fb0d15d8d80: Observer: 0x7fb0d15d5010, Key path: arrowBase, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d8cc0>
< NSKeyValueObservance 0x7fb0d15d9310: Observer: 0x7fb0d15d5010, Key path: arrowHeight, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d7790>
< NSKeyValueObservance 0x7fb0d15d9850: Observer: 0x7fb0d15d5010, Key path: outerShadowColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d9770>
< NSKeyValueObservance 0x7fb0d15d9f00: Observer: 0x7fb0d15d5010, Key path: outerShadowBlurRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d9e20>
< NSKeyValueObservance 0x7fb0d15da460: Observer: 0x7fb0d15d5010, Key path: outerShadowOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15da3a0>
< NSKeyValueObservance 0x7fb0d15da970: Observer: 0x7fb0d15d5010, Key path: outerCornerRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d9fb0>
< NSKeyValueObservance 0x7fb0d15daea0: Observer: 0x7fb0d15d5010, Key path: innerShadowColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15da510>
< NSKeyValueObservance 0x7fb0d15db3b0: Observer: 0x7fb0d15d5010, Key path: innerShadowBlurRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15db2f0>
< NSKeyValueObservance 0x7fb0d15db9f0: Observer: 0x7fb0d15d5010, Key path: innerShadowOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15db930>
<NSKeyValueObservance 0x7fb0d15d9060: Observer: 0x7fb0d15d5010, Key path: innerCornerRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d91c0>
< NSKeyValueObservance 0x7fb0d15dc620: Observer: 0x7fb0d15d5010, Key path: viewContentInsets, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15dc560>
< NSKeyValueObservance 0x7fb0d15dcdc0: Observer: 0x7fb0d15d5010, Key path: overlayColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15dcd00>
)'

How to center popover after rotation

I'm experiencing an odd behavior when you create a new project and import the WYPopover classes that the popover does not stay center after rotation. Oddly enough, the popup stays center after rotation in the example project. I am wondering what I am missing as I have tried everything.

I have basically copied and pasted line for line to the new blank project with no results.

iOS 8 style

What an amazing control!

Is there iOS 8 (rounded arrow) style support planned?

Crash when presenting an UIActivityViewController in popover on iPad

Hello,
First of all, thanks for maintaining this project!

I encounter a crash when touching the "More" button of an UIActivityViewController presented in a system popover on iPad with iOS8.

ios simulator screen shot 1 nov 2014 15 13 33

Crash happens in WYPopoverController.m file:
crash

You can reproduce the crash by using my modified version of the demo project (I simply added a toolbar with a button to present a UIActivityViewController 4f2e755) on my fork:
https://github.com/Bluezen/WYPopoverController/tree/demoCrash
You have to run the demo project on an iPad (real device or simulator) with iOS8, touch the button on the toolbar then touch the "More" button.

I still can't figure out why there is a EXC_BAD_ACCESS here so I'm using a "ghetto fix" for the moment:

if ([self isKindOfClass:[UINavigationController class]] == NO && self.navigationController != nil && [self respondsToSelector:@selector(popoverPresentationController)] == NO)
    {

but this doesn't solve the underlying problem and is just one ugly way to work around it.

I hope someone investigation will prove better than mine.

Dismiss in TableViewController

Hi there I have the following setup.

BaseViewController - This controller implements the WYPopoverDelegate and sets up the menu.

ViewController - A view that shows the actual popup of a TableView.

Everything works perfectly, but I can't dismiss the Popup when a item is selected from my TableView. Here is the code I have for dismissing:

In BaseViewController:

    func closeMenu(){
        self.popoverControllerShouldDismissPopover(popoverController)
    }

    func popoverControllerDidDismissPopover(popoverController: WYPopoverController!) {
        println("DISMISS")
        self.popoverController!.delegate = nil
        self.popoverController = nil
    }

In ViewController/Tableview

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        println("You selected cell #\(indexPath.row)!")
        super.closeMenu()
    }

Blurred transparent background?

Hi, @sammcewan !
Thanks for your work maintaining this awesome project.
I wonder If it's possible to set blurred background to popover like it appears in iOS 7+ native popovers?

Section header

How can i eliminate the section headers? I just want to show the tableviewcells. Testing with the settingsviewcontroller

Popover hides instantly

Hi,
I want to use WYPopoverController in my iOS 8 app using the following code:

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"selectMapViewController"];

WYPopoverController *popoverController = [[WYPopoverController alloc] initWithContentViewController:vc];
popoverController.delegate = self;
popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:WYPopoverArrowDirectionAny animated:YES];

When I tap the connected button, I can see the Popover View fading in, but it is disappearing instantly.
What am I doing wrong?

Cheers

Swizzling crash.

Here is an interesting one.

In iOS8.1 if you use a UIActivityViewController and tap the "More..." button in the activity popup the app will crash in sizzled_setPreferredContentSize. Just the presence of WyPopoverController in the app causes this even if it has never been used/called.

Shame since I am using the popover in conjunction with a UIInputAccessory keyboard toolbar on iPhone and it works better than the new iOS 8 popover presentation style. (which doesn't dismiss when tapping on the keyboard)

Accessibility / UIAutomation

I love this control, it provides some great functionality in my app.
I've been able to add an inline date picker and use it in most screens in my app.

However, I really struggle with accessibility, I need to use it as I have comprehensive UI Automation scripts. I've tried adding the same accessibility labels and most other things, however it doesn't seem to matter what I add, the rows don't show accessibility correctly.

On some screens, where I don't have dynamic content I've had to add catch blocks and x / y coordinates to allow selection.

However on more complicated screens, I've have to have manual intervention, this is a real pain.

So any work on accessibility would be awesome.

UIBarButtonItems behind popover become desaturated

Even if i set the overlay color to clear, any buttons or controls look disabled, but can be interacted with since we have a lot of passthrough views. Only happens on iOS 7 with the official popover and also looks the same.

(Making a search app that displays results in a list and map at the same time, user needs to be able to interact with list and map + buttons at the same time).

How to add offset to the Popover

Is there any way to add offset to the popover itself. I mean how do I present popover with some offset to the sender view, so it is moved with the offset. Maybe a UIEdgeInset property? I use segue example by the way.

How do i reposition a popover after rotation?

How does one actually use -popoverController:willRepositionPopoverToRect:inView:?

I tried the following without luck:

- (void)popoverController:(WYPopoverController *)popoverController willRepositionPopoverToRect:(inout CGRect *)rect inView:(inout UIView *__autoreleasing *)view
{
    DLog(@"Present position %f %f %f %f", rect->origin.x, rect->origin.y, rect->size.width, rect->size.height);

    rect->origin.x = 100.f;
    rect->origin.y = 100.f;

    DLog(@"New position %f %f %f %f", rect->origin.x, rect->origin.y, rect->size.width, rect->size.height);
}

The output from this is:

Present position 0.000000 0.000000 0.000000 0.000000
New position 100.000000 100.000000 0.000000 0.000000

However the popover origin still appears to be 0,0,0,0 after rotation.

Change dimming

Nevermind. I found how to change the dimming by using overlayColor.

KIF compatibility

Hi,
I'm trying to use WYPopoverController together with KIF tests. Unfortunately it crashes when trying to display a popover. I'm trying to run this on the iPad 2 iOS 8.1 simulator. If i just hit โŒ˜R and tap the UI element that causes a popover to appear, it works perfectly. But if i press โŒ˜Uto run the tests and tap the search bar it crashes. I also tried manually tapping the search bar before KIF takes any actions (by making KIF wait using [tester waitForTimeInterval:60]) and it crashes then as well, so at least we can rule out KIF tapping the wrong element or tapping it in the wrong way.

It crashes on [_inView.window addSubview:_backgroundView];

Full backtrace:

<unknown>:0: error: -[HITDirectSearchTests testDirectHit0702011***] : failed: caught "NSInvalidArgumentException", "*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil"
(
    0   CoreFoundation                      0x04a25946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x0433ea97 objc_exception_throw + 44
    2   CoreFoundation                      0x048dcc01 -[__NSArrayM insertObject:atIndex:] + 881
    3   CoreFoundation                      0x048dc861 -[__NSArrayM addObject:] + 65
    4   UIKit                               0x0311535c PushNextClassForSettingIMP + 383
    5   UIKit                               0x03115149 __workaround10030904InvokeWithTarget_block_invoke + 29
    6   UIKit                               0x02b67f05 +[UIView _performCustomizableAppearanceModifications:] + 29
    7   UIKit                               0x03115121 workaround10030904InvokeWithTarget + 1047
    8   UIKit                               0x0310ee05 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 4248
    9   UIKit                               0x0310f624 +[_UIAppearance _applyInvocationsTo:window:] + 56
    10  UIKit                               0x02b836f5 -[UIView(Internal) _applyAppearanceInvocations] + 287
    11  UIKit                               0x02b84139 __88-[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]_block_invoke + 65
    12  UIKit                               0x02b840c6 -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 204
    13  UIKit                               0x02b83ff3 -[UIView(Internal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 57
    14  UIKit                               0x02b83fb2 -[UIView(Internal) _didChangeFromIdiomOnScreen:traverseHierarchy:] + 172
    15  UIKit                               0x02b835a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1685
    16  UIKit                               0x02b7a517 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 154
    17  UIKit                               0x02b7a475 -[UIView(Hierarchy) _postMovedFromSuperview:] + 458
    18  UIKit                               0x02b85f0d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2018
    19  UIKit                               0x02b7886e -[UIView(Hierarchy) addSubview:] + 56
    20  hitta.se                            0x0054099a -[WYPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:options:completion:] + 2650
    21  hitta.se                            0x005425a7 -[WYPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:options:completion:] + 519
    22  hitta.se                            0x0054227b -[WYPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:completion:] + 219
    23  hitta.se                            0x00542185 -[WYPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:] + 149
    24  hitta.se                            0x00161cbe -[HITSearchViewController showFavoritePopover] + 670
    25  hitta.se                            0x00161a12 -[HITSearchViewController openFavoriteView] + 306
    26  libobjc.A.dylib                     0x043547cd -[NSObject performSelector:withObject:withObject:] + 84
    27  UIKit                               0x02aff23d -[UIApplication sendAction:to:from:forEvent:] + 99
    28  UIKit                               0x02e6f840 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139
    29  libobjc.A.dylib                     0x043547cd -[NSObject performSelector:withObject:withObject:] + 84
    30  UIKit                               0x02aff23d -[UIApplication sendAction:to:from:forEvent:] + 99
    31  UIKit                               0x02aff1cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
    32  UIKit                               0x02c32e86 -[UIControl sendAction:to:forEvent:] + 69
    33  UIKit                               0x02c332a3 -[UIControl _sendActionsForEvents:withEvent:] + 598
    34  UIKit                               0x02c3250d -[UIControl touchesEnded:withEvent:] + 660
    35  UIKit                               0x02b4f60a -[UIWindow _sendTouchesForEvent:] + 874
    36  UIKit                               0x02b500e5 -[UIWindow sendEvent:] + 791
    37  UIKit                               0x02b15549 -[UIApplication sendEvent:] + 242
    38  UIKit                               0x02b2537e _UIApplicationHandleEventFromQueueEvent + 20690
    39  UIKit                               0x02af9b19 _UIApplicationHandleEventQueue + 2206
    40  CoreFoundation                      0x049491df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    41  CoreFoundation                      0x0493eced __CFRunLoopDoSources0 + 253
    42  CoreFoundation                      0x0493e248 __CFRunLoopRun + 952
    43  CoreFoundation                      0x0493dbcb CFRunLoopRunSpecific + 443
    44  CoreFoundation                      0x0493d9fb CFRunLoopRunInMode + 123
    45  hitta.se Tests                      0x108d81cd -[KIFTestActor tryRunningBlock:complete:timeout:error:] + 461
    46  hitta.se Tests                      0x108d8456 -[KIFTestActor runBlock:complete:timeout:] + 182
    47  hitta.se Tests                      0x108d868b -[KIFTestActor runBlock:timeout:] + 139
    48  hitta.se Tests                      0x108d8bf9 -[KIFTestActor waitForTimeInterval:] + 233
    49  hitta.se Tests                      0x10540333 -[HITDirectSearchTests setUp] + 403
    50  XCTest                              0x201088e8 -[XCTestCase invokeTest] + 173
    51  XCTest                              0x20108bb9 -[XCTestCase performTest:] + 184
    52  XCTest                              0x20114162 -[XCTest run] + 314
    53  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    54  XCTest                              0x20114162 -[XCTest run] + 314
    55  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    56  XCTest                              0x20114162 -[XCTest run] + 314
    57  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    58  XCTest                              0x20114162 -[XCTest run] + 314
    59  XCTest                              0x20103de2 __25-[XCTestDriver _runSuite]_block_invoke + 61
    60  XCTest                              0x20110c82 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 184
    61  XCTest                              0x20103d06 -[XCTestDriver _runSuite] + 285
    62  XCTest                              0x20104951 -[XCTestDriver _checkForTestManager] + 272
    63  XCTest                              0x20104c6b -[XCTestDriver runTestSuite:completionHandler:] + 378
    64  XCTest                              0x2011775c +[XCTestProbe runTests:] + 216
    65  Foundation                          0x01b3fb57 __NSFireDelayedPerform + 423
    66  CoreFoundation                      0x0497f8d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    67  CoreFoundation                      0x0497f25d __CFRunLoopDoTimer + 1309
    68  CoreFoundation                      0x0493e6ba __CFRunLoopRun + 2090
    69  CoreFoundation                      0x0493dbcb CFRunLoopRunSpecific + 443
    70  CoreFoundation                      0x0493d9fb CFRunLoopRunInMode + 123
    71  GraphicsServices                    0x0717624f GSEventRunModal + 192
    72  GraphicsServices                    0x0717608c GSEventRun + 104
    73  UIKit                               0x02afd8b6 UIApplicationMain + 1526
    74  hitta.se                            0x001b5d07 main + 167
    75  libdyld.dylib                       0x056a9ac9 start + 1
)

UINavigationControllerDelegate method call crash

screen shot 2015-05-21 at 15 48 04
I'm working on an app that incorporates WYPopoverController and it works great in place where it should. I want to add custom animations between two controllers, instead of built in push / pop.

In navigation controller containing FROM and TO controllers I don't do anything related to the WYPopoverController, neither in controllers FROM and TO.

I've implemented navigation controller delegate, really simple and animator class that handles actual animation.

public class NavigationControllerDelegate: NSObject, UINavigationControllerDelegate {

    let animator = Animator()

    public func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation, fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {

        if operation == UINavigationControllerOperation.Pop {
            return self.animator
        }

        return nil
    }
}
class Animator: NSObject, UIViewControllerAnimatedTransitioning {

    public func transitionDuration(transitionContext: UIViewControllerContextTransitioning) -> NSTimeInterval {
        return 0.33
    }

    public func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
        let toVC = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!
        let fromVC = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!

        transitionContext.containerView().addSubview(toVC.view)
        toVC.view.alpha = 0

        UIView.animateWithDuration(self.transitionDuration(transitionContext), animations: { () -> Void in
            fromVC.view.transform = CGAffineTransformMakeScale(0.1, 0.1)
            toVC.view.alpha = 1
        }) { (finished) -> Void in
            fromVC.view.transform = CGAffineTransformIdentity
            transitionContext.completeTransition(!transitionContext.transitionWasCancelled())
        }
    }

}

In the FROM controller I initialize navigation delegate

override public func viewDidLoad() {
    super.viewDidLoad()
    // ... some other code here
    self.navigationController?.delegate = NavigationControllerDelegate()
}

Everything compiles and runs up until the point when I tap the (collection) cell and want to move to TO controller. At that point app crashes with error:

-[CALayer navigationController:animationControllerForOperation:fromViewController:toViewController:]: unrecognized selector sent to instance 0x7fc72e53e970

I've added a breakpoint and I end up inside sizzled_pushViewController:animated: method of UINavigationController. To be honest I have no idea how to approach the issue.

iOS8 UIAlertController hides behind WYPopoverController

In iOS 8, if you show an alert with UIAlertController while there is a WYPopoverController in the center of the screen, the WYPopoverController will be obstructed by the alert (as in the screenshot).

I tried presenting the UIAlertController from the keyWindow but the result is the same, the WYPopoverController is on top of everything.

Any ideas how to fix this?
(I have already asked this on the nicolaschengdev master, and tried this newer fork to see if this problem persists, and it does)

tttt

UIDocumentInteractionController incompatibility

Hi,

I've found an incompatibility with the UIDocumentInteractionController in iOS8. If you include the WYPopoverController in your project then run this code...

@property (nonatomic, strong) UIDocumentInteractionController* documentInteractionController;



NSString* path = [[NSBundle mainBundle] pathForResource:@"Untitled" ofType:@"pages"];
NSURL* url = [NSURL fileURLWithPath:path];
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.documentInteractionController.delegate = self;
CGRect bottomCenter = CGRectMake((self.view.frame.size.width / 2) - 2, self.view.frame.size.height, 2, 2);
[self.documentInteractionController presentOpenInMenuFromRect:bottomCenter inView:self.view animated:YES];

The popover launches but now when you press the "More" button you end up in a recursive loop in the WYPopoverLibrary

- (void)sizzled_setPreferredContentSize:(CGSize)aSize
{
    [self sizzled_setPreferredContentSize:aSize];

    if ([self isKindOfClass:[UINavigationController class]] == NO && self.navigationController != nil)
    {
#ifdef WY_BASE_SDK_7_ENABLED
        if ([self respondsToSelector:@selector(setPreferredContentSize:)]) {
            [self.navigationController setPreferredContentSize:aSize];
        }
#endif
    }
}

As a pretty horrific fix I've done the following, but this is super brittle. It would be great to know what's actually up and get something in that's more re-usable

- (void)sizzled_setPreferredContentSize:(CGSize)aSize
{
    [self sizzled_setPreferredContentSize:aSize];

    if ([self isKindOfClass:[UINavigationController class]] == NO && self.navigationController != nil)
    {
#ifdef WY_BASE_SDK_7_ENABLED
        if ([NSStringFromClass([self class]) hasPrefix:@"_UIActivityUserDefaultsViewController"] == NO) {
            if ([self respondsToSelector:@selector(setPreferredContentSize:)]) {
                [self.navigationController setPreferredContentSize:aSize];
            }
        }
#endif
    }
}

Incorrect popover offset if keyboard is visible

On iOS7 the problem exist in UIInterfaceOrientationPortraitUpsideDown and UIInterfaceOrientationLandscapeRight interface orientations

On iOS8 the problem can be reproduces in case of any Landscape screen orientation

ios simulator screen shot jul 8 2015 13 50 06

UIViewController(popoverController's contentViewController) was deallocated while key value observers were still registered with it

Since I noticed that new fork that might be actively maintained I decided to move this bug over here.

This was reported in the original baseline with no answers.
I've run into the same issue:

UIViewController(popoverController's contentViewController) was deallocated while key value observers were still registered with it...

Two taps on an actual device (not simulator) in quick succession reliably cause the error.
Seems the second tap starts a new popover which attempts to dealloc the first instance before the first one can finish initializing.

I'm looking over the code but am open to suggestions on how to prevent this.
Ideas?

Presenting view controllers on detached view controllers is discouraged

It's important that we are able to present view controllers directly from the content view controller of the popover controller (see #25 for an example).

However, when we do, we get the following warning in the console:
Presenting view controllers on detached view controllers is discouraged

It's only a harmless warning for now, but it could become worse in a future OS update, so it really should be fixed.

I believe the fix should be to be able to pass a parent view controller through the API, and set the content view controller as a child of its parent, using the addChildViewController method (see documentation).

iOS8 + iPhone 6+: crash in drawRect

In WYPopoverController.m, drawRect:

CGRect innerRect = CGRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect) + barHeight, CGRectGetWidth(rect) , CGRectGetHeight(rect) - barHeight);

If innerRect.size.width or innerRect.size.height is 0, the code crashes when creating UIBeizerPath

UIBezierPath* inRoundedRectPath = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(innerRect, 0.5, 0.5) cornerRadius:cornerRadius];

This happens to me only when testing the code in iOS8 + iPhone 6+.

popover not showing after segue

Hello,
I have created a uiViewController (lets say main app view) that contains a WYpopoverController that is shown as a dialog when clicked on a button. And that works fine.
The problem comes when i instead of set the initial view controller that main view, i set another uiviewcontroller lets say login and then use a Segue to that main view upon success. I click the same button in the main view and nothing happens.
The custom popover view controller is beeing called, because the viewDidLoad is called also i tried to put some logs into -viewDidAppear and its also shown. but nothing never comes up into the phone.
its like its running on the background below my main view.

Thanks for your time

Theme observer invokes -updateThemeUI multiple times

Each time a WYPopoverConrtoller is init, the static theme var is re-configured.
But since there is also an observer on the _theme var, the observer is invoked for every changed theme property during the init, which results in performing the -updateThemeUI method about 20 times in a row.

I suggest creating an temp WYPopoverTheme object, and to save it to the static var after fully configured. This will invoke the observer only once.

Thank you.

Touching the shadow dismisses the popover

Hi,
if i set some passthrough views and make the background a clear color the popover doesn't dismiss when i touch elements close to it. If i however set a big shadow and touch a component within the shadow area, the popover will dismiss.

Any idea about how to change this?

Misalignment when rapidly changing orientation back and forth

If you quickly change the orientation of a device to landscape and then quickly back to portrait, the second orientation change will not trigger the delegate method -popoverController:willRepositionPopoverToRect:inView:

This is because the order in which the notifications didChangeStatusBarOrientation: and didChangeDeviceOrientation are not the same the second time (statusBar notification comes after device), and the _isInterfaceOrientationChanging ivar is not set to YES when the deviceOrientation notification occurs.

This is only visible if you run the code on an actual device - the simulator doesn't allow for such rapid orientation changes. And my testing has so far been limited to iOS 8.

A (quick) fix for this is to remove the use of the ivar flag - the purpose of which is undocumented. What side-effects could we see by removing these lines?
(Removing the ivar doesnt fix the issue)

Upon further investigation it seems the didChangeDeviceOrientation is happening 1 run loop earlier than the status change, and at that point even calling the delegate will not solve the problem as all other orientation & layout info hasnt changed yet. The solution I am working on now is implementing a setNeedsReposition method, and calling that in both status & device orientation change methods:

    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(performReposition) object:nil];
    [self performSelector:@selector(performReposition) withObject:nil afterDelay:0];

Does this seem like a viable solution?

AutoLayout support?

Can you specify the size of the popover just using the AutoLayout constraints of the content view controller? I can't see an easy way of doing that.

Popover not re-appearing after calling dismissPopoverAnimated

On iOS7 only (iOS8 it's OK) - when manually doing
[popoverController dismissPopoverAnimated:YES];

And then trying to re-open the popover (using presentPopoverFromRect)

In the original project I got observation leak. On this fork (thanks for maintaining BTW) I don't get an error but I'm experiencing the same issue.

The error I got when used the original project:

An instance 0x7fa658d31340 of class NewChapterViewController was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x7fa65b01eda0> (
<NSKeyValueObservance 0x7fa658ca31d0: Observer: 0x7fa658d33220, Key path: preferredContentSize, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fa658c829f0>

Tried to debug it - it seems that this is the preferredContentSize but this is as far as I succeeded

Contentview not clipped to popover

Hi,
Is there a specific reason the content view of the popover isn't clipped to the size of the popover? My specific problem with this is that when the popover content grows in size, the content view size changes immediately, and the popover animates slowly behind it. Looks really ugly.

I fixed it in my branch by just setting backgroundView.clipsToBounds = YES;

Popovers in landscape won't display correctly

I must be doing something wrong but from reading the readme I am not seeing it. Whenever I rotate to landscape view and perform a presentPopoverFromBarButtonItem:permittedArrowDirections:animated: the popover is not rotated and has an irregular height. What could cause this?

Unable to dismiss popover from popover.

Hey everyone, I am having an odd issue thats easy to solve, I probably just can't see it. Basically, I am trying to programmatically dismiss the popover from the popover, for which I haven't had success with.
Here is the code I am trying (hooked up to a button in the popover):
[self.delegate dismissPopoverAnimated:YES];
where delegate is set to:
selectionViewController.delegate = (MasterViewController*) self.view.window.rootViewController;
MasterViewController is the view controller from which I am instigating the popover. Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.