ios - 如何在 iOS 中的 tableview 底部添加图像

标签 ios iphone uitableview

我想在表格 View 的底部添加图像。但它不应该与 tableview 一起滚动

请任何人有想法请分享。

我正在尝试如下

UIImage *img = [UIImage imageNamed:@"image.png"];
UIImageView *imgView = [[UIImageView alloc]initWithImage:img];
imgView.frame = CGRectMake(0, 0, img.size.width, img.size.height);
CGRect frame = imgView.frame;
frame.origin.x = 0;
frame.origin.y = self.tableView.frame.size.height - img.size.height;
imgView.frame = frame;
imgView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
[self.view addSubview:imgView];

但是它是随着tableview一起滚动的

最佳答案

您可以使用`UITableview 的setTableFooterView 方法,在表格 View 的底部设置一个 View 。

swift :

self.tableView.tableFooterView = UIImageView(image: myImageView)

objective-C :

[[self tableView] setTableFooterView:[self myImageview]];  

希望对你有帮助

关于ios - 如何在 iOS 中的 tableview 底部添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23842766/

相关文章:

iphone - 在 Textview 中共享数据并维护数据状态不起作用

ios - 如何仅更改一个特定行的高度?

swift - 标签中的文本从屏幕溢出 iOS Swift

ios - 自定义scrollView,当滚动时,移动标题 View

ios - 使用Cordova InAppBrowser时如何消除iPhone/iOS白屏弹跳?

ios - 来自 MTLBuffer 问题的 MTLTexture

iphone - coreLocation多久更新一次

iOS:单击 TableCellView 内的 View

ios - 应用程序在启动时崩溃 -- iTunes (ios)

ios - 如何检测iphone 4s