在ipad中拖放功能

时间:2011-10-20 14:12:01

标签: ios

我正在开发一个iPad应用程序,其中需要将UIScrollView中的图像拖放到UIWebView中的文本字段。我已经通过文档找到了可可的拖放主题。但是当实现拖放协议时,我遇到了错误。打击是我的代码,任何帮助都表示赞赏。

@implementation drangAndDropSampleViewController

@synthesize scrollView1, scrollView2;

- (id)initWithFrame:(CGRect)frame {
    return [super initWithFrame:frame];
}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint location = [touch locationInView:touch.view];
    cloud.center = location;
    //scrollView1.center = location;
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [self touchesBegan:touches withEvent:event];
}


- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event { 
    // If not dragging, send event to next responder
    if (!self.dragging) 
        [self.nextResponder touchesEnded: touches withEvent:event]; 
    else
        [super touchesEnded: touches withEvent: event];
}

提前致谢。

0 个答案:

没有答案