YIDetectWindow 1.0.1

YIDetectWindow 1.0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 定制
发布上次发布2014年12月

Yasuhiro Inami 维护。



  • Yasuhiro Inami

YIDetectWindow 1.0.1

基于 UIWindow 的子类,能够检测摇晃、状态栏点击、长按、触摸开始/移动/结束/取消,通过 NSNotification。

如何使用

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIViewController* rootViewController = self.window.rootViewController;

    // replace UIWindow with YIDetectWindow
    YIDetectWindow* window = [[YIDetectWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    window.detectsShake = YES;
    window.detectsStatusBarTap = YES;
    window.detectsTouchPhases = YES;
    window.detectsLongPress = YES;

    self.window = window;
    self.window.rootViewController = rootViewController;
    [self.window makeKeyAndVisible];

    return YES;
}

通知

extern NSString* const YIDetectWindowDidReceiveShakeNotification;
extern NSString* const YIDetectWindowDidReceiveStatusBarTapNotification;
extern NSString* const YIDetectWindowDidReceiveTouchesBeganNotification;
extern NSString* const YIDetectWindowDidReceiveTouchesMovedNotification;
extern NSString* const YIDetectWindowDidReceiveTouchesEndedNotification;
extern NSString* const YIDetectWindowDidReceiveTouchesCancelledNotification;
extern NSString* const YIDetectWindowDidReceiveLongPressNotification;

许可证

YIDetectWindowBeerware 许可证下可用。

如果我们某天相遇,你觉得这些材料很有价值,你可以买我一杯啤酒作为回报。