Krutarth Patel Krutarth Patel - 3 months ago 9
iOS Question

how to display image in fullsize in UIPageViewController?

i am currently working in welcome screen.

for that i have take UiPageViewController.

i have download demo from appcode

link is : UIPageViewController

but when i download demo image is displaying like this.

Demo

my requirement is i want to display images in fullsize
what to do please help me

Answer

on that code change the height for e.g

 // Change the size of page view controller
self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height + 30 ); it is by default -30 change to any one of + 30 or else

you get the output as

enter image description here

updated answer

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 // Override point for customization after application launch.
 //    UIPageControl *pageControl = [UIPageControl appearance];
//    pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
//    pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
//    pageControl.backgroundColor = [UIColor clearColor];

return YES;
}

or else just change pageControl.currentPageIndicatorTintColor = [UIColor blackColor]; clearColor

Update- 2

Step-1

// hide your PageControl in Appdelegate 

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 // Override point for customization after application launch.
 //    UIPageControl *pageControl = [UIPageControl appearance];
//    pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
//    pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
//    pageControl.backgroundColor = [UIColor clearColor];

return YES;
}

Step-2

on your pageConttroller Declaration View Controller do like

@interface SurveyViewController (){
UIPageControl *pagecontrol;
NSInteger currentIndex;
}

- (void)viewDidLoad {
currentIndex = 0;
 [self setupPageControl];
}

- (void)setupPageControl{
pagecontrol = [UIPageControl  appearance];
pagecontrol.pageIndicatorTintColor = [UIColor lightGrayColor];
pagecontrol.currentPageIndicatorTintColor = APPBGCOLOR;
pagecontrol.backgroundColor = [UIColor clearColor];
[self.view bringSubviewToFront:pageControl];


}


- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController{
return currentIndex;
}


- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
NSUInteger index = ((PageContentViewController*) viewController).pageIndex;

if ((index == 0) || (index == NSNotFound)) {
    return nil;
}

index--;
 currentIndex = index;
[self.pageControl setCurrentPage:index];
return [self viewControllerAtIndex:index];
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
 NSUInteger index = ((PageContentViewController*) viewController).pageIndex;

if (index == NSNotFound) {
    return nil;
}

index++;
if (index == [self.pageTitles count]) {
    return nil;
}
 currentIndex = index;
  [self.pageControl setCurrentPage:index];
return [self viewControllerAtIndex:index];
}
Comments