iOS: Make the PDF view same size as the device width height -
there grey colour in background , cannot make full size of pdf. there way make full screen of pdf? have detected orientation , made pdf size accordingly.
edited:
nsstring *path = [[nsbundle mainbundle] pathforresource:@"pdf2" oftype:@"pdf"]; nsurl *pdfurl = [nsurl fileurlwithpath:path]; pdfdocument = cgpdfdocumentcreatewithurl((__bridge cfurlref)pdfurl); totalpages = (int)cgpdfdocumentgetnumberofpages(pdfdocument); //modelarray holds page numbers modelarray = [[nsmutablearray alloc] init]; (int index = 1; index <= totalpages; index++) { [modelarray addobject:[nsstring stringwithformat:@"%i", index]]; } thepageviewcontroller = [[uipageviewcontroller alloc] initwithtransitionstyle:uipageviewcontrollertransitionstylepagecurl navigationorientation:uipageviewcontrollernavigationorientationhorizontal options:nil]; thepageviewcontroller.delegate = self; thepageviewcontroller.datasource = self; thepageviewcontroller.view.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; contentviewcontroller = [[contentviewcontroller alloc] initwithpdf:pdfdocument]; contentviewcontroller.page = [modelarray objectatindex:0]; nsarray *viewcontrollers = [nsarray arraywithobject:contentviewcontroller]; [thepageviewcontroller setviewcontrollers:viewcontrollers direction:uipageviewcontrollernavigationdirectionforward animated:no completion:nil]; [self addchildviewcontroller:thepageviewcontroller]; [self.view addsubview:thepageviewcontroller.view]; thepageviewcontroller.view.frame = cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [thepageviewcontroller didmovetoparentviewcontroller:self]; self.view.backgroundcolor = [uicolor underpagebackgroundcolor];
Comments
Post a Comment