如何在UIPageViewController中以fullsize显示图像?

时间:2016-08-30 10:43:03

标签: ios objective-c uipageviewcontroller

我目前正在欢迎屏幕上工作 因为我已经采取了UiPageViewController 我从appcode下载演示 链接是:UIPageViewController

但是当我下载演示图像时就是这样显示的。

Demo

我的要求是我希望以fullsize显示图像 该怎么做请帮助我

1 个答案:

答案 0 :(得分:2)

在该代码上更改例如

的高度
 // 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

你得到的输出为

enter image description here

更新回答

- (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;
}

或者只是更改pageControl.currentPageIndicatorTintColor = [UIColor blackColor]; clearColor

更新 - 2

<强>步骤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;
}

<强>步骤-2

页面上的

控制器声明视图控制器就像

@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];
}