我有一個UITextView(用於多行)可以在屏幕上拖動的項目。到目前爲止,我的解決方案已經覆蓋了一個無形的UIButton,當它拖動它的中心時與UITextView的中心相同。如何在視圖屏幕上拖動UITextView?
但是我見過的應用程序似乎只是允許UITextView在飛行中進行拖動和編輯,因此看起來可能沒有覆蓋這些但我不確定。
想法?
順便說一句,C在這段代碼是UIButton的,這是我迄今爲止已經移動了它:
- (void) draggedOut: (UIControl *) c withEvent: (UIEvent *) ev
{
if(self.interfaceOrientation == UIInterfaceOrientationPortrait)
{
c.center = [[[ev allTouches] anyObject] locationInView:self.view];
AddedText.center = c.center;
}
else if(self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
c.center = [[[ev allTouches] anyObject] locationInView:self.view];
AddedText.center = c.center;
}
else if(self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
c.center = [[[ev allTouches] anyObject] locationInView:self.view];
AddedText.center = c.center;
}
else if(self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
c.center = [[[ev allTouches] anyObject] locationInView:self.view];
AddedText.center = c.center;
}
}