Question

I am trying to add an icon to a SBSearchTableViewCell.

I was adding a subview on top of the cell but that still left a border, and the text was underneath the icon.

http://i.imgur.com/tGqWaEa.png

I tried hooking into -[SBSearchModel _imageForDomain:andDisplayID:] but the domain is 0 and the displayID is (null).

Code: http://pastebin.ca/2460380

Resources:

Était-ce utile?

La solution

Did you try to set image using -(void)setTitleImage:(id)image animated:(BOOL)animated; method (I'm not sure what it does, but that is the only method to set image in the cell you are using...)? And, How about just creating your own labels, and place them on the right places? That should not be that hard, I think. Good Luck!

EDIT Sorry it seems like the method I mentioned is available only on iOS 7 and higher. I suggest you to use you own UILabels and UIImageView with imitation to the original.

ANOTHER EDIT It looks like the SBSearchTableViewCell is the subclass of the UITableViewCell, so why don't you use the it's imageView property to set the image (or, icon) to the cell?

Autres conseils

You can move the border over by setting cell.sectionHeaderWidth. Then you can add a subview like you already have done.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top