带有分割视图控制器的扭曲视图框架

发布于 2024-11-15 00:55:16 字数 874 浏览 4 评论 0原文

在我的具有分割视图控制器的应用程序中,我有一个加载视图。我的根视图控制器是 UITableViewController 的子类;加载数据时,我保存 self.view 并将其与加载视图一起转换:

- (void)loadingWillBegin {
    self.cachedView = self.view;
    self.progressBar.progress = 0.0;
    [UIView transitionFromView:self.view toView:self.loadingView duration:1.0 options: UIViewAnimationOptionTransitionCurlDown completion:NULL];
    self.view = self.loadingView;
}

- (void)loadingDidFinish {
    [UIView transitionFromView:self.loadingView toView:self.cachedView duration:1.0 options:UIViewAnimationOptionTransitionCurlUp completion:NULL];
    self.view = cachedView;
}

转换工作正常,但在加载视图分页后,表视图的框架全部搞砸了。顶部有一个与状态栏大小相同的黑条(我确实清除了状态栏模拟指标),并且视图延伸到屏幕的实际底部下方。框架看起来和loadingView一样;在该视图上,我将 iPad 模拟指标 设置为 Master,这导致视图高度约为 820 像素。无论该选项的设置如何,Xcode 4 都不允许我更改 Size Inspector 中的视图框架。

我应该如何处理视图的框架?

In my application which features a split view controller I have a loading view. My Root View Controller is a subclass of UITableViewController; while loading data I save self.view and transition it out with the loading view:

- (void)loadingWillBegin {
    self.cachedView = self.view;
    self.progressBar.progress = 0.0;
    [UIView transitionFromView:self.view toView:self.loadingView duration:1.0 options: UIViewAnimationOptionTransitionCurlDown completion:NULL];
    self.view = self.loadingView;
}

- (void)loadingDidFinish {
    [UIView transitionFromView:self.loadingView toView:self.cachedView duration:1.0 options:UIViewAnimationOptionTransitionCurlUp completion:NULL];
    self.view = cachedView;
}

The transitions work fine, but after the loading view is paged out the frame of the table view is all screwed up. THere is a black bar at the top of the same size as a status bar (I did clear the Status Bar Simulated Metrics), and the view extends below the actual bottom of the screen. The frame seems to be the same as the loadingView; on that view I have set the iPad Simulated Metrics to Master, which led to the view being about 820px tall. Regardless of that option's setting, Xcode 4 is not allowing me to change the frame of the view in the Size Inspector.

What should I do about the frame of the view?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走走停停 2024-11-22 00:55:16

动画完成后,您可以手动设置正确的帧。

[UIView transitionFromView:self.loadingView toView:self.cachedView duration:1.0 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished){self.cachedView.frame = /* Insert appropriate frame here. */;}];

On completion of your animation you could manually set the correct frame.

[UIView transitionFromView:self.loadingView toView:self.cachedView duration:1.0 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished){self.cachedView.frame = /* Insert appropriate frame here. */;}];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文