开发者

How to change the size of the grid of TTThumbsViewController

开发者 https://www.devze.com 2023-02-15 09:16 出处:网络
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 standa开发者_Python百科rd size (up to 4x4 t

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 standa开发者_Python百科rd 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.


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

0

精彩评论

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