Skip to content

Instantly share code, notes, and snippets.

@zedzhao
zedzhao / hitTest
Created April 7, 2014 07:27
Determine if touch occurs in subview
- (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){
@zedzhao
zedzhao / GetAllApps
Created November 5, 2014 02:08
Get all apps in the device
#include <objc/runtime.h>
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSLog(@"apps: %@", [workspace performSelector:@selector(allApplications)]);
[[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"]) {
}