我正在尝试将a的背景颜色设置UITableViewCell为透明.但似乎没有任何效果.我内部有一些图像/按钮tableViewCell,我想让白色grouptableview背景消失,以获得图像和按钮的"浮动"效果(好像它们不在里面tableview).
知道如何实现这一目标吗?
有没有办法找出哪个UITableViewCell位于滚动窗口的顶部?
我想获取当前滚动位置,以便我可以在应用程序退出时保存它.当应用程序启动时,我想滚动到它上次退出时的位置.
我试图获取index所选项目TableView并在此之后开始一些活动.不幸的是,我发现的大多数解决方案都是客观的,或者不起作用.
方法func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)不打印cell标签..
有人可以帮帮我吗?
import UIKit
import ResearchKit
class TaskListViewController: UIViewController, UITableViewDataSource {
let tasks=[("Short walk"),
("Audiometry"),
("Finger tapping"),
("Reaction time"),
("Spatial span memory")
]
//how many sections are in your table
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
//return int how many rows
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tasks.count
}
//what are the contents
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) … 我遇到了一个非常令人费解的错误.我的UITableView 的第一行返回1,第二行在indexPath中返回0!这怎么可能呢?
在我的` - (void)viewDidLoad`中,一切都还可以.我正在成功突出第一行
currentRow = 0;
[tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:currentRow inSection:0]
animated:NO scrollPosition:UITableViewScrollPositionNone];
Run Code Online (Sandbox Code Playgroud)
我有currentRow用于跟踪选择哪一行的变量(另一个控件根据当前选择的一个而变化).
现在在我的`didDeselectRowAtIndexPath`委托函数中,我有:
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
...
NSLog(@"IndexPath: %@", [indexPath description]);
}
Run Code Online (Sandbox Code Playgroud)
日志显示以下内容:
IndexPath: <NSIndexPath 0x79509d0> 2 indexes [0, 0]当我触摸第二行时,以及
IndexPath: <NSIndexPath 0x79509d0> 2 indexes [0, 1]当我触摸第一行时.
没有行插入或删除或排序等,甚至没有滚动.它是一个简单的UITableView,分组样式,有1个部分和3行.可能是什么导致了这个?
谢谢你的帮助,
S
iphone objective-c uitableview didselectrowatindexpath nsindexpath
在我的应用程序中,我使用了一个UITableView
我的问题是我要删除最后一个单元格的最后一个边框UITableView.
请检查以下图片:
你好有很多问题回答的动态高度的UITableViewCell的UITableView.但是当我这样做时,我发现它很奇怪.
这是一些答案:
通常这会回答细胞的动态高度
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
Run Code Online (Sandbox Code Playgroud)
但在我的情况下,我想知道这条线不会做任何事情.
UITableView单击splitview中的tabbar后,我正在查看我的内容.这有用吗?
也许我错过了什么.谁能帮助我,我花了2个小时做傻事.
这些是我对标题的约束,标题可能很长,但标签不是.

这是我的手机

我正在尝试创建一个UITableView可变高度行,如本问题的答案中所述
我的问题是每个单元格包含一个UIWebView具有不同(静态加载)的内容我无法弄清楚如何根据内容计算合适的高度.有没有办法做到这一点?我尝试过这样的事情:
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
WebViewCell *cell = (WebViewCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath];
[cell setNeedsLayout];
[cell layoutIfNeeded];
return cell.bounds.size.height;
}
Run Code Online (Sandbox Code Playgroud)
细胞本身是从笔尖加载的,笔尖只是一个UITableViewCell含有a 的笔尖UIWebView.(如果细胞只是将自己调整到html内容的最大值,那也没关系,尽管可变高度会更好).
我在界面构建器中有一个简单的tableViewCell构建.它包含一个包含图像的UIView.现在,当我选择单元格时,会显示默认的蓝色选择背景,但我的UIView的backgroundColor消失了.
我的UITableViewCell的实现文件没有做任何特别的事情.它只是init和&返回self,我在setSelected中所做的就是调用super.
如何在选择tableView时显示我的UIView backgroundColor?
我已经浏览了有关UITableView类和委托引用的Apple文档,但无法找到明确设置表头高度的方法.
我使用以下委托设置表格单元格高度:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
并使用以下代理设置节标题/页脚高度.
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
谁能帮我设置表格页眉/页脚高度?
谢谢.
可变长度的动态文本被注入tableview单元格标签.为了使tableview单元格的高度动态调整,我实现了viewDidLoad():
self.tableView.estimatedRowHeight = 88.0
self.tableView.rowHeight = UITableViewAutomaticDimension
Run Code Online (Sandbox Code Playgroud)
这适用于尚未UITableViewAutomaticDimention滚动到的单元格(在滚动到单元格时调用),但不适用于在加载具有数据的表格时最初在屏幕上呈现的单元格.
我试过简单地重新加载数据(如许多其他资源中所建议的):
self.tableView.reloadData()
Run Code Online (Sandbox Code Playgroud)
在这两个viewDidAppear()和viewWillAppear(),这是无济于事.我迷了..有没有人知道如何让xcode渲染最初在屏幕上加载的单元格的动态高度?
如果有更好的替代方法,请告诉我.
uitableview ×10
ios ×6
iphone ×6
objective-c ×4
swift ×3
cocoa-touch ×2
row-height ×2
xcode ×2
nsindexpath ×1
uiscrollview ×1
uiview ×1
uiwebview ×1