DanielR
DanielR

Reputation: 21

How to change the size of the grid of TTThumbsViewController

I'm using the Three20 Photo Gallery and wondered if it's possible to have two different grid sizes in two different galleries. So in Gallery one I use the standard size (up to 4x4 thumbs) and in the other I only want a 2x2 gallery size. Is that possible and if yes how (I suppose subclassing comes into play)? I would really appreciate some code samples. Thanks a lot.

Upvotes: 2

Views: 732

Answers (1)

Xuvi
Xuvi

Reputation: 519

I did the same thing and my solution was like this

1, Extend TTThumbsDataSource and override

  • (NSInteger)columnCount { // CGFloat width = TTScreenBounds().size.width; // return round((width - kThumbSpacing*2) / (kThumbSize+kThumbSpacing)); return 3; }

  • (Class)tableView:(UITableView*)tableView cellClassForObject:(id)object { if ([object conformsToProtocol:@protocol(TTPhoto)]) { return [TTThumbsTableViewCell_Ext class]; } else { return [super tableView:tableView cellClassForObject:object]; } }

2, Extend TTThumbsTableViewCell and change the setting

_thumbSize = 95 (your calculated size) in

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier

Upvotes: 2

Related Questions