简单代码..
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
- (IBAction)dragout:(id)sender;
@end
ViewController.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
在Storyboard中,有1个按钮,其大小适合文本“按钮”。链接'发送事件:触摸拖动外部“到”拖出“IBAction。
当我触摸内部按钮并将手指拖到按钮外部时,我需要移动多于按钮大小来调用“拖出”IBAction。近3倍的宽度和高度尺寸。为什么会这样?请阅读。