开发者

Covering space from one UITableView's cell with another one

The design of the UITableView is something like this:

Covering space from one UITableView's cell with another one

I want to make my cells with a tiny triangle, like in a comic book. The th开发者_如何学Going is, how can i add the triangle to the size of my custom cell? The common rectangle size wouldn't work if i want the user to be able to tap that little rectangle.

And how can i make the opposite? I want the triangle to cover the space of another cell, so tapping the little triangle of the first cell, covering part of the second cell's rectangle space, would activate de first one. This is, substracting a little triangle from the cell's space.


Not sure it would work, but building on user697562's comment, you could try the following:

  1. Add a small UIView to the table cell to represent the small triangle
  2. Rotate it using its transform property, making sure that, along with its frame, it will have the proper placement.
  3. Add a UITapGestureRecognizer to the UIView
  4. Add an instance variable to the view to save the indexPath of the cell it's in (or even the above cell, since it will be associated with the above cell). This way when the gesture recognizer is triggered, you know what row you're in.
  5. Write the action method associated with the gesture recognizer to do the same thing as tableView:didSelectRowAtIndexPath: would do for the above cell.
  6. Set the separatorStyle property of the UITableView to UISeparatorStyleNone, so that it won't draw the lines between cells. If this doesn't work just set the separatorColor property to your table cell's background color.
  7. Draw a border along the top & bottom of the cell, accounting for the triangle.

Good luck with it! Let me know whether it works if you try it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜