Knowledge Base - Adaptation for iPhone X

1. In RDPDFViewController.h add a new variable

float thumbViewHeight;

2. In RDPDFViewController.m edit these parts:

  • In viewWillAppear method remove

[_toolBar sizeToFit];

    self.navigationItem.titleView = _toolBar;

and add

     [_toolBar setFrame:CGRectMake(0, 0, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height)];

    [self.navigationController.navigationBar addSubview:_toolBar];

  • In searchView method

add

    CGRect statusbarRect = [[UIApplication sharedApplication] statusBarFrame];

[_searchToolBar setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin];

remove

[_toolBar addSubview:_searchToolBar];

and replace with

[self.navigationController.navigationBar addSubview:_searchToolBar];

and edit

if(SYS_VERSION>=7.0)
{
float hi = self.navigationController.navigationBar.bounds.size.height;
_m_searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, hi+statusbarRect.size.height, cwidth, 41)];
}

  • Add the new prefersHomeIndicatorAutoHidden method:

-(BOOL)prefersHomeIndicatorAutoHidden
{
return YES;
}

  • In didRotateFromInterfaceOrientation method add

    thumbViewHeight = 99;

    CGRect statusbarRect = [[UIApplication sharedApplication] statusBarFrame;

[_searchToolBar sizeToFit];

remove from if(SYS_VERSION>=7.0)

[m_Thumbview setFrame:CGRectMake(0, cheight-50, cwidth, 50)];
[m_Thumbview sizeThatFits:CGRectMake(0, cheight-50, cwidth, 50).size];
[_m_searchBar setFrame:CGRectMake(0,hi+20,cwidth,41)];

and add 

[m_Thumbview setFrame:CGRectMake(0, cheight-thumbViewHeight, cwidth, thumbViewHeight)];
[m_Thumbview sizeThatFits:CGRectMake(0, cheight-thumbViewHeight, cwidth, thumbViewHeight).size];
[_m_searchBar setFrame:CGRectMake(0,hi+statusbarRect.size.height,cwidth,41)];

remove from else condition

[m_Thumbview setFrame:CGRectMake(0, cheight-hi-50-20, cwidth, 50)];
[m_Thumbview sizeThatFits:CGRectMake(0, cheight-hi-50-20, cwidth, 50).size];
[_m_searchBar setFrame:CGRectMake(0, 0, cwidth, 41)];

and add

[m_Thumbview setFrame:CGRectMake(0, cheight-hi-thumbViewHeight-statusbarRect.size.height, cwidth, thumbViewHeight)];
[m_Thumbview sizeThatFits:CGRectMake(0, cheight-hi-thumbViewHeight-statusbarRect.size.height, cwidth, thumbViewHeight).size];
[_m_searchBar setFrame:CGRectMake(0, 0, cwidth, 41)];

  • In PDFOpenPDFOpenStream and PDFopenMem methods add

CGRect statusbarRect = [[UIApplication sharedApplication] statusBarFrame];

and in the else cycle of if(SYS_VERSION>=7.0) remove

m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height-20-44)];

and add

m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height-statusbarRect.size.height-44)];

  • In PDFThumbNailinit method remove

float hi = self.navigationController.navigationBar.bounds.size.height;
CGRect rect;
rect = [[UIApplication sharedApplication] statusBarFrame];

and add

float hi = 44;
CGRect statusbarRect = [[UIApplication sharedApplication] statusBarFrame];

in the end edit

if(SYS_VERSION>=7.0)
{
m_Thumbview = [[PDFThumbView alloc] initWithFrame:CGRectMake(0, cheight-thumbViewHeight, cwidth, thumbViewHeight)];
_pageNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, statusbarRect.size.height+hi+1, 65, 30)];
}
else{
m_Thumbview = [[PDFThumbView alloc] initWithFrame:CGRectMake(0, cheight-hi-thumbViewHeight-statusbarRect.size.height, cwidth, thumbViewHeight)];
_pageNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 65, 30)];
}

[m_Thumbview vOpen :m_doc :(id<PDFThumbViewDelegate>)self];
[self.view addSubview:m_Thumbview];
_pagenow = pageno;

3. Add LaunchImages for iPhone X or no kinds of code editing will works.

 

Applies To

RadaeePDF SDK for iOS

Details

Created : 2018-05-02 14:41:34, Last Modified : 2018-05-03 08:52:10