Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF

TOPIC:

error when toggling between portrait and landscape mode 5 years 9 months ago #13957

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 261
  • Thank you received: 18
Hi,
To keep on focus your text field I suggest you to check the filedType in OnAnnotClicked method in RDPDFViewController class:
if (annot.fieldType == 1)
    {
        currX = x;
        currY = y;
    }
And so in shouldAutorotateToInterfaceOrientation method:
if (![textFd.text isEqual: @""]){
        [m_view setEditBoxWithText:textFd.text];
        [self OnSingleTapped:currX :currY];
    }
So you could simulate a tap in your textField.

Please Log in or Create an account to join the conversation.

error when toggling between portrait and landscape mode 5 years 9 months ago #13960

  • pooja
  • pooja's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 38
  • Thank you received: 0
Hi, I tried these changes but it still doesn't work.

Please Log in or Create an account to join the conversation.

error when toggling between portrait and landscape mode 5 years 9 months ago #13965

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

on rotation event the page is re-rendered, so you lose the current annotation instance.
You can get the annotation index when you tap on it the first time (add [m_annot getIndex], in PDFView class when the annotation is tapped), then get the same annotation after the rotation using the index.

In PDFView class you can add a method to force the OnAnnotEditBox with something like:
m_annot = [page annotAtIndex:index];
[m_annot getRect:&m_annot_rect];
                    
annotRect.origin.x = m_annot_rect.left / m_scale;
annotRect.origin.y = m_annot_rect.top / m_scale;
annotRect.size.width = (m_annot_rect.right - m_annot_rect.left)/m_scale;
annotRect.size.height = (m_annot_rect.bottom - m_annot_rect.top)/m_scale;
[m_delegate OnAnnotEditBox :annotRect : nuri :([m_annot getEditTextSize]/m_scale) * [m_view vGetScale]];

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum