1

简单的代码..

视图控制器.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
- (IBAction)dragout:(id)sender;

@end

视图控制器.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)dragout:(id)sender {
    NSLog(@"-----");
}
@end

在情节提要中,有 1 个按钮,其大小适合文本“按钮”。将“发送事件:触摸外部”链接到“dragout”IBAction。

当我触摸按钮内部并将手指拖到按钮外部时,我需要移动超过按钮大小才能调用“dragout”IBAction。近 3 倍的宽度和高度尺寸。为什么会这样?谢谢阅读。

4

0 回答 0