Frequently Asked Question
How to change view mode programmatically on iOS
Last Updated 11 months ago
This article shows how to change view mode programmatically:
In RDPDFViewController class you can add this method:
- (void)setReaderViewMode:(int)mode { int currentPage = [m_view vGetCurrentPage]; if( m_view != nil ) { [m_view vClose]; [m_view removeFromSuperview]; m_view = NULL; } g_def_view = mode; [[NSUserDefaults standardUserDefaults] setInteger:mode forKey:@"ViewMode"]; [[NSUserDefaults standardUserDefaults] synchronize]; CGRect rect = [[UIScreen mainScreen] bounds]; if (![self isPortrait] && rect.size.width < rect.size.height) { float height = rect.size.height; rect.size.height = rect.size.width; rect.size.width = height; } if(SYS_VERSION>=7.0) { m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height)]; } else { m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height-20-44)]; } [m_view vOpen :m_doc :(id)self]; pagecount =[m_doc pageCount]; if (m_Thumbview) { [self.view insertSubview:m_view belowSubview:m_Thumbview]; } m_bSel = false; [self PDFGoto:currentPage]; }