ios 드래그 가능한 보기 만들기
1913 단어 드래그 가능 뷰 생성하기
- CGPoint originalLocation; // ,
- -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- {
- UITouch *touch = [touches anyObject];
- originalLocation = [touch locationInView:self.view];
-
- }
- -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
- {
- UITouch *touch = [touches anyObject];
- CGPoint currentLocation = [touch locationInView:self.view];
- CGRect frame = self.view.frame;
- frame.origin.x += currentLocation.x - originalLocation.x;
- frame.origin.y += currentLocation.y - originalLocation.y;
-
- self.view.frame = frame;
- }
"이 문서는""Record""블로그에서 작성되었으므로 반드시 출처를 보존하십시오."http://mjrao.blog.51cto.com/6086668/1011088