PrettyKit icon indicating copy to clipboard operation
PrettyKit copied to clipboard

Example of a custom view cell

Open kpmaalej opened this issue 13 years ago • 6 comments

I think the example lacks the use of a PrettyCustomViewTableViewCell.

Specifically, I have a project where I use this class, and I haven't quite understood how to use it correctly. My cells contents aren't properly masked (the view goes out of the boundaries when there are rounded corners) and I haven't found a public property to set the view.

Could you enlighten me?

kpmaalej avatar Oct 02 '12 17:10 kpmaalej

Sure. Create a UIView with your custom content, and then set the customView property of the PrettyCustomViewTableViewCell to your view. That should be enough.

In fact, PrettyGridTableViewCell is a subclass of PrettyCustomViewTableViewCell, so you may take a look there to better understand how it works.

Anyway, I've found its performance is not very good, so don't rely too much on it :)

vicpenap avatar Oct 02 '12 17:10 vicpenap

Hmm, I design my custom cells in Interface Builder, not in code, so... how does adding a IBOutlet to the customView property sounds?

kpmaalej avatar Oct 02 '12 17:10 kpmaalej

I can't tell. I've never done that before :|

vicpenap avatar Oct 02 '12 17:10 vicpenap

There's probably a misunderstanding, otherwise your reply doesn't really make sense :)

I was proposing to change line 44 of PrettyCustomViewTableViewCell.h from

@property (nonatomic, strong) UIView *customView; 

to

@property (nonatomic, strong) IBOutlet UIView *customView; 

and pushing this change in a pull request (new or by adding it to the other if you don't mind).

kpmaalej avatar Oct 02 '12 17:10 kpmaalej

Oh sorry :)

I will probably take a look at it tomorrow then.

vicpenap avatar Oct 02 '12 17:10 vicpenap

FYI, I just changed it on my local repo and it fixes my problem. I then just have to connect the view to the customView outlet in IB.

kpmaalej avatar Oct 02 '12 17:10 kpmaalej