我正在开展一个项目,我必须预先选择一个特定的单元格.
我可以预先选择一个单元格-willDisplayCell,但是当用户点击任何其他单元格时我无法取消选择它.
- (void)tableView:(UITableView*)tableView
willDisplayCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath
{
AppDelegate_iPad *appDelegte =
(AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
if ([appDelegte.indexPathDelegate row] == [indexPath row])
{
[cell setSelected:YES];
}
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
AppDelegate_iPad *appDelegte =
(AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
NSIndexPath *indexpath1 = appDelegte.indexPathDelegate;
appDelegte.indexPathDelegate = indexPath;
[materialTable deselectRowAtIndexPath:indexpath1 animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
你能帮我吗?
我已经编写了自己的函数来在键盘出现时向上滚动文本字段.为了通过点击文本字段来关闭键盘,我创建了一个UITapGestureRecognizer在点击时关注文本字段上的第一响应者.
现在,我还为UITableView文本字段创建了一个自动完成功能,在文本字段正下方创建一个自动填充,并在用户输入文本时用项目填充它.
但是,当选择自动完成表中的一个条目时,didSelectRowAtIndexPath不会被调用.相反,似乎轻敲手势识别器正在被调用并且刚刚辞职第一响应者.
我猜是有一些方法可以告诉轻敲手势识别器继续将点击消息传递到下方UITableView,但我无法弄清楚它是什么.任何帮助将非常感激.
有没有办法在StoryBoard中插入表头视图(tableHeaderView)(就像我们以前在Interface Builder中那样)?
我想自定义UITableView中所有UITableViewCells的背景(也可能是边框).到目前为止,我还没有能够自定义这些东西,所以我有一堆白色背景单元格,这是默认的.
有没有办法用iPhone SDK做到这一点?
我想长时间按UITableViewCell下来打印"快速访问菜单".有人已经这样做了吗?
特别是手势识别UITableView?
我正在尝试在UIViewController中的UITableView中实现一个pull to refresh功能.我不能使用UITableViewController,因为我希望UITableView在视图控制器中是一个较小的子视图,上面还有一些其他东西.我认为这是可能的,但有没有人看过它的实现?
我正在实现一个颜色选择表视图,用户可以在其中选择10种颜色(取决于产品).用户还可以选择其他选项(如硬盘容量......).
所有颜色选项都在他们自己的tableview部分中.
我想在textLabel左侧显示一个小方块,显示实际颜色.
现在我正在添加一个简单的方形UIView,给它正确的背景颜色,如下所示:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RMProductAttributesCellID];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:RMProductAttributesCellID] autorelease];
cell.indentationWidth = 44 - 8;
UIView *colorThumb = [[[UIView alloc] initWithFrame:CGRectMake(8, 8, 28, 28)] autorelease];
colorThumb.tag = RMProductAttributesCellColorThumbTag;
colorThumb.hidden = YES;
[cell.contentView addSubview:colorThumb];
}
RMProductAttribute *attr = (RMProductAttribute *)[_product.attributes objectAtIndex:indexPath.section];
RMProductAttributeValue *value = (RMProductAttributeValue *)[attr.values objectAtIndex:indexPath.row];
cell.textLabel.text = value.name;
cell.textLabel.backgroundColor = [UIColor clearColor];
UIView *colorThumb = [cell viewWithTag:RMProductAttributesCellColorThumbTag];
colorThumb.hidden = !attr.isColor;
cell.indentationLevel …Run Code Online (Sandbox Code Playgroud) 我有自定义UITableView使用UITableViewCells.每个UITableViewCell都有2个按钮.单击这些按钮将更改UIImageView单元格内的图像.
是否可以单独刷新每个单元格以显示新图像?任何帮助表示赞赏.
我有Swift类的问题.我有一个UITableViewController类和UITableViewCell类的swift文件.我的问题是UITableViewCell类和出口.这个类有一个错误类"HomeCell"没有初始化器,我不明白这个问题.
谢谢你的回复.
import Foundation
import UIKit
class HomeTable: UITableViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet var tableViex: UITableView!
var items: [(String, String, String)] = [
("Test", "123", "1.jpeg"),
("Test2", "236", "2.jpeg"),
("Test3", "678", "3.jpeg")
]
override func viewDidLoad() {
super.viewDidLoad()
var nib = UINib(nibName: "HomeCell", bundle: nil)
tableView.registerNib(nib, forCellReuseIdentifier: "bookCell")
}
// Number row
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.items.count
}
// Style Cell
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { …Run Code Online (Sandbox Code Playgroud) 我现在试图这样做几天,在阅读了大量试图这样做的人的消息之后,我仍然无法UITextField在我的一些人中完全工作UITableViewCells,就像在这个例子中一样:

要么我的表单工作,但文本不可见(虽然我将其颜色设置为蓝色),当我点击它时键盘在场上,我无法正确实现键盘事件.我尝试了一些来自Apple的例子(主要是UICatalog,有一个类似的控件),但它仍然无法正常工作.
有人可以帮我(和所有的人试图实现这种控制)和后一个简单实现的UITextField一个UITableViewCell,工作正常?
uitableview ×10
ios ×9
iphone ×5
objective-c ×4
cocoa-touch ×2
long-press ×1
storyboard ×1
swift ×1
uitextfield ×1
xcode4 ×1