gpt4 book ai didi

ios - 如何在固定位置(无滚动)的 UITableView 后面插入 imageView?

转载 作者:行者123 更新时间:2023-11-28 21:48:17 25 4
gpt4 key购买 nike

我正在尝试使用以下方法在我的表格 View 后面插入一张图片:

 UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newpink120"]];
imageView.frame=CGRectMake([[UIScreen mainScreen]bounds].size.width-60, [[UIScreen mainScreen]bounds].size.height-60-self.navigationController.navigationBar.frame.size.height, 60, 60);
[self.tableView addSubview:imageView];
[self.tableView sendSubviewToBack:imageView];

这似乎可行,但图像会随着表格滚动。有什么办法让它固定在右下角吗?

最佳答案

要创建一个静态的tableview背景,你必须做两件事

1) 设置self.tableView.backgroundColor = [UIColor clearColor];

2) 然后用 UIImageView 初始化表格背景 View ,并设置要在那里显示的图像。

[self.tableView setBackgroundView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]] ];

关于ios - 如何在固定位置(无滚动)的 UITableView 后面插入 imageView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29252632/

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