How to change the size of the grid of TTThumbsViewController

孤街浪徒 提交于 2019-12-22 18:05:08

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/5236599/how-to-change-the-size-of-the-grid-of-ttthumbsviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!