gpt4 book ai didi

iOS 将 subview 带回

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:56:33 26 4
gpt4 key购买 nike

我想让一个 View 显示在另一个 View 的顶部。

这是我的 View 层次结构:

enter image description here

基本上我想把按钮(重新开始)放在属于 PageViewController 的 UIImageView 前面。所以我希望能够使用图像顶部的按钮进行滚动。

这是我的代码:

- (void)viewDidLoad
{
[super viewDidLoad];
// Create the data model
_pageTitles = @[@"Over 200 Tips and Tricks", @"Discover Hidden Features", @"Bookmark Favorite Tip", @"Free Regular Update"];
_pageImages = @[@"page1.png", @"page2.png", @"page3.png", @"page4.png"];

// Create page view controller
self.pageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PageViewController"];
self.pageViewController.dataSource = self;

PageContentViewController *startingViewController = [self viewControllerAtIndex:0];
NSArray *viewControllers = @[startingViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

// 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);

[self addChildViewController:_pageViewController];
[self.view addSubview:_pageViewController.view];
[self.pageViewController didMoveToParentViewController:self];

}

最佳答案

您是否尝试过使用以下代码?

[self.view bringSubviewToFront:yourButtonView];

关于iOS 将 subview 带回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33637912/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com