如何在 UIPageViewController 中以全尺寸显示图像?
how to display image in fullsize in UIPageViewController?
我目前正在欢迎屏幕中工作。
为此,我选择了 UiPageViewController。
我已经从 appcode
下载了演示
link 是:UIPageViewController
但是当我下载演示图像时显示是这样的。
我的要求是我想以全尺寸显示图像
怎么办请帮帮我
在该代码上更改高度,例如
// 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
你得到的输出是
更新答案
- (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
第一步
// 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 步
在你的 pageController 声明视图控制器上喜欢
@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];
}
我目前正在欢迎屏幕中工作。
为此,我选择了 UiPageViewController。
我已经从 appcode
下载了演示
link 是:UIPageViewController
但是当我下载演示图像时显示是这样的。
我的要求是我想以全尺寸显示图像 怎么办请帮帮我
在该代码上更改高度,例如
// 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
你得到的输出是
更新答案
- (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
第一步
// 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 步
在你的 pageController 声明视图控制器上喜欢
@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];
}