Skip to content

Instantly share code, notes, and snippets.

View nonstriater's full-sized avatar

移动开发小冉 nonstriater

View GitHub Profile
@nonstriater
nonstriater / AppDelegate.m
Created March 20, 2017 06:52 — forked from brunojppb/AppDelegate.m
Allow landscape mode in specific ViewControllers
/* Allow Landscape mode for specific ViewControllers */
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
UIViewController* topVC = [self topViewControllerWith: self.window.rootViewController];
if ([topVC respondsToSelector:@selector(canRotate)]) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
return UIInterfaceOrientationMaskPortrait;
}
/* get the top ViewController */
@nonstriater
nonstriater / UIAlertViewCrashFix.h
Last active August 29, 2015 14:26 — forked from joshhudnall/UIAlertViewCrashFix.h
A potential fix to a new crash in iOS 8.3 where UIAlertViews will crash because they expect a different auto rotation behavior than what they are getting.
//
// UIAlertViewCrashFix.h
//
// Created by Josh Hudnall on 4/28/15.
//
//
#import <Foundation/Foundation.h>
@interface UIAlertController (CrashFix)
@nonstriater
nonstriater / spy.d
Last active August 29, 2015 14:16 — forked from markd2/spy.d
#!/usr/sbin/dtrace -s
/* Run like:
% sudo csh
# ./spy.d $PROCESS_ID [$INTERESTING_PROBEPROV]
Prints a line of dashes every 5 seconds to delineate different experiments.
*/
#pragma D option quiet