Sunday, May 1, 2011

UITableView - delete button

Hi, in my app when user swipes a certain row I want to display a delete button. And when the button appears it obscures IndexTitles and another label in my cell (it has subviews).

How can I customize my table when the button appears?

Thank you.

From stackoverflow
  • What do you mean by "obscures"? Does your content shrink to give space to the delete button or the button draws over your content?

    In the latter case, you should be considering adding your content as subviews of the cell's contentView.

  • Building off of E-ploko, may sure you're not positioning things absolutely. ie, if you want something to appear 10 pixels from the right boundary of the content view, calculate what the position should be, don't assume a constant width.

  • Does the cell textLabel allow autosizing and is lineBreakMode set to UILineBreakModeTailTruncation?

    [[cell textLabel] setLineBreakMode: UILineBreakModeTailTruncation];
    [[cell textLabel] setAutoresizingMask: UIViewAutoresizingFlexibleRightMargin];
    

    If the cell contents isn't flexible it will probably be obscured when the delete button appears.

0 comments:

Post a Comment