Objective C:如何设置子视图在当前可见帧中显示? (UI表格视图)
我有一个 UITableViewController 并打算在单击按钮(即刷新按钮)时向其添加子视图。我的代码如下:
//set up loading page
self.myLoadingPage = [[LoadingPageViewController alloc]init ];
self.myLoadingPage.view.frame = self.view.bounds;
self.myLoadingPage.view.hidden = NO;
[self.view addSubview:self.myLoadingPage.view];
我的问题是如何设置此子视图位于当前可见帧中?特别是对于 UITableviewcontroller,我可能会在向下滚动到第 100 个单元格后单击刷新按钮,对于本示例,我的子视图仍将添加到表视图的顶部(从单元格 1 开始)。有什么办法可以解决这个问题吗?
I have a UITableViewController and intend to add a subview to it when I click a button i.e. refresh button. My code is as follows:
//set up loading page
self.myLoadingPage = [[LoadingPageViewController alloc]init ];
self.myLoadingPage.view.frame = self.view.bounds;
self.myLoadingPage.view.hidden = NO;
[self.view addSubview:self.myLoadingPage.view];
My question is how can I set this subview to be in the current visible frame? especially for a UITableviewcontroller where I might click on the refresh button after scrolling down to the 100th cell, for this example, my subview will still be added right at the top of the table view (starting from cell 1). Is there any way to resolve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需移动线条,以便在将其设为子视图后设置框架
Just move the lines around so that you set the frame after you made it a subview