fastred / AHKActionSheet

An alternative to the UIActionSheet inspired by the Spotify app.
MIT License
1.16k stars 130 forks source link

Does not take top most view #1

Closed salam closed 10 years ago

salam commented 10 years ago

Hi fastred,

The library is great. However, it currently takes a screenshot of a wrong view (not necessarily the visible one). It's why I have updated the show() method in the AHKActionSheet class:

    // Modified part starts in line 217

    UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
    while (topController.presentedViewController) {
        topController = topController.presentedViewController;
    }
    self.previousKeyWindow = topController.view.window;

    UIImage *previousKeyWindowSnapshot = [topController.view AHKsnapshotImage];
    // End modified part in line 226

Hope you like it,

Matthias

fastred commented 10 years ago

Thanks for reporting this issue.

Can you see if snapshotting UIWindow, instead of the rootViewController's view, in the following way:

self.previousKeyWindow = [UIApplication sharedApplication].keyWindow;
UIImage *previousKeyWindowSnapshot = [self.previousKeyWindow AHKsnapshotImage];

leads to the proper outcome (this simple example won't work in the landscape)?

salam commented 10 years ago

Yes, that actually works, too! I don't know about landscape mode thou, since my current app is portrait-mode only.