问题
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