【发布时间】:2015-01-30 09:48:01
【问题描述】:
我在根视图控制器中嵌入了 UIPageViewController。
如下图。
但我想设置第一、第二个视图控制器背景透明,它仍然可以显示视图控制器文本 1 和 2。
所以它会显示根背景颜色(黑色),并且根视图控制器可以通过 uipageviewcontroller 滑动。
我的pageviewcontroller部分代码如下:
- (void)viewDidLoad {
[super viewDidLoad];
self.delegate = self;
self.dataSource = self;
pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.backgroundColor = [UIColor clearColor];
UIViewController *p1 = [self.storyboard
instantiateViewControllerWithIdentifier:@"Intro1ID"];
UIViewController *p2 = [self.storyboard
instantiateViewControllerWithIdentifier:@"Intro2ID"];
myViewControllers = @[p1,p2];
[self setViewControllers:@[p1]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO completion:nil];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
self.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
}
有没有人可以教我如何将 containerview 背景颜色设置为透明并可以显示 1 、 2 文本? (它是示例代码,所以只有 1、2 文本)
非常感谢。
【问题讨论】:
-
[[p1 view] setBackgroundColor:[UIColor clearColor]];?p2也一样? -
哦哦哦!!你是对的,@Larme。你能输入答案问题吗?我会给你正确的答案。谢谢:P
标签: ios containers transparent