Skip to content

Instantly share code, notes, and snippets.

zedzhao

Block or report user

Report or block zedzhao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View detect keyboard mode chagne
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changeInputMode:)
name:UITextInputCurrentInputModeDidChangeNotification object:nil];
- (void)changeInputMode:(NSNotification*)notification
{
NSString *inputMethod = [[UITextInputMode currentInputMode] primaryLanguage]; //判断当前键盘类型, emoji en-US en-HANS
if ([inputMethod isEqualToString:@"emoji"]) {
}
@zedzhao
zedzhao / GetAllApps
Created Nov 5, 2014
Get all apps in the device
View GetAllApps
#include <objc/runtime.h>
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSLog(@"apps: %@", [workspace performSelector:@selector(allApplications)]);
@zedzhao
zedzhao / hitTest
Created Apr 7, 2014
Determine if touch occurs in subview
View hitTest
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *subView = [super hitTest:point withEvent:event];
if (UIEventTypeTouches == event.type) {
BOOL isOutsideTouch = (subView != self);
if(!isOutsideTouch){
for (UIView *s in self.subviews){
You can’t perform that action at this time.