iosタッチパネル事件マニュアル



// ( )
    infoView=[[UIView alloc] initWithFrame:CGRectMake(20, 100,220, 280)];// ,
    infoView.backgroundColor=[UIColor blueColor];
    infoView.alpha=0.6;
    [self.view addSubview:infoView];
    /****************** *****************/// , , 。
    UISwipeGestureRecognizer *recognizer;
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
    [infoView addGestureRecognizer:recognizer];
//    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
//    [recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];
//    [self.view addGestureRecognizer:recognizer];
//    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
//    [recognizer setDirection:(UISwipeGestureRecognizerDirectionDown)];
//    [self.view addGestureRecognizer:recognizer];
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
    [infoView addGestureRecognizer:recognizer];
//
// 1
-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer{
    //
    if(recognizer.direction==UISwipeGestureRecognizerDirectionLeft) {
        NSLog(@"**************** ****************");
    }
    //
    if(recognizer.direction==UISwipeGestureRecognizerDirectionRight) {
        NSLog(@"**************** ****************");      
    }
   if (recognizer.direction==UISwipeGestureRecognizerDirectionDown){
       NSLog(@"**************** ****************");
    }
    if (recognizer.direction==UISwipeGestureRecognizerDirectionUp){
      NSLog(@"**************** ****************");
   }
}
方法二:

GSEventRecord header;    
GSHardwareKeyInfo key = {0,0,0,0,1,{'a'},1,{'a'},0,0,0,0};    
memset(&header, 0, sizeof(header));    
header.type = kGSEventKeyDown;    
header.infoSize = sizeof(GSHardwareKeyInfo);    
header.timestamp = mach_absolute_time();    
struct    
{    
    GSEventRecord header1;    
    GSHardwareKeyInfo key1;    
}fuck = {header, key};    
GSSendEvent(&fuck, GSGetPurpleApplicationPort());   
    GSEventRecord header; 
    GSHardwareKeyInfo key = {0,0,0,0,1,{'a'},1,{'a'},0,0,0,0}; 
    memset(&header, 0, sizeof(header)); 
    header.type = kGSEventKeyDown; 
    header.infoSize = sizeof(GSHardwareKeyInfo); 
    header.timestamp = mach_absolute_time(); 
    struct 
    { 
        GSEventRecord header1; 
        GSHardwareKeyInfo key1; 
    }fuck = {header, key}; 
    GSSendEvent(&fuck, GSGetPurpleApplicationPort());
以上述べましたが、本文の内容は全部です。お好きになってください。