English 中文(简体)
如何编制海关表格 观感细胞学
原标题:How to make a custom tableView cell accessory

I have not yet found any really good examples on how to do this. There is an image that I want to use as the accessory button and when I put it in and click on it doesn t work. So it looks correct but doesn t work... Here is my code:

[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
cell.accessoryView = [[UIImageView alloc]
    initWithImage:[UIImage imageNamed:@"TableView_Green_Disclosure.png"]];

因此,我如何获得我的“UIImageView”电话:。 何时加以利用?

最佳回答

Check the blog post hdr->cmdline for creating custom accessory view for UITableView. The author used UIButton objects with images for custom accessory view.

问题回答

对<条码>的读法和<条码>的读法>将显示,它们是定制一个单元的相互排斥的方法。

订立<代码> 出入代码<> <>代码>后,表层代表法在启用时即行使用。

Setting the accessoryView will ignore the setting of accessoryType and give you something to display. If you want to receive a callback from the custom view you ve put in place, it should be a control that is wired up to do so. (Or any view with a gesture recognizer.)

如果你使用一个纽扣吨,并采取行动以<条码>使用:,你将接受纽扣为“发送”理由。 在你找到一张桌子之前,你可以走下观点等级,然后请您的桌子看这个细胞的指数。 这样,你就能够把索引输入你的模型目标,并且能够适当地采取行动。

除纽伦外,您可以就上述两点意见进行交流,并给它增加姿态识别器。

为了让纽特人实际做些事情,你需要执行<条码>-(避免)表征:可调的意见* View AccessoryButtonTappedForRowWithIndexPath:NSIndexPath *)indexPath from UITableViewDelegate.

如果一行使用一个子宫,将采用这一方法,并且你有机会在指数道路上适当采取行动,以确定哪一个行距。

为了利用本信——你需要把囚室设为附属室 易读电文的类型将UIButton(有相关图像)存放在电池中,然后通过电线接收用户。 你们可能会使用以下法典,因为国际商业行动对UIButton的手机的反应正在触及:

- (IBAction) accessoryButtonPressed:(id) sender
{
NSUInteger pathInts[] = { 0,0 };
pathInts[1] = self.currentselectedrow; // ivar set when tableview row last selected
NSIndexPath* indexPath = [NSIndexPath indexPathWithIndexes:pathInts length:2];
[self tableView:mytableview accessoryButtonTappedForRowWithIndexPath:indexPath];
}

UIButton将在座标“ForRowAtIndexPath:”功能内通过一条线执行这一冰川法。

[thecell setButtonTarget:self  action:@selector(accessoryButtonPressed:)];

我注意到的一件事是,UIButton似乎想要一种 s子,而是一种简单的主线,以便引发这一事件——但我可以说,这是解决问题的。 请注意,我增加了一个UIButton* 标语,名为“从业Button”的物品。

In the cell s source you d support the setButtonTarget call with code like this:

- (void) setButtonTarget:(MyViewController*)inTarget action:(SEL) inAction
{
[self.cell_accessoryButton addTarget: inTarget
                      action: (SEL) inAction
            forControlEvents: UIControlEventTouchUpInside];
}

公正使用从业者参考书和从业者重提(但如果你想要一种习俗图象等),这是另一个行之有效的道路。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签