Change thumbs size in TTThumbsViewController

2019-08-01 06:25发布

问题:

Does anybody know if there is a way to increase the size of the images on the grid in a TTThumbsViewController in the three20 framework?

Thanks

回答1:

If you're using the TTThumbsViewController, you'll have to edit that file.

Change the kThumbSize to the size you want, and kThumbnailRowHeight to that value+4 (for the padding).

Then, in tableView:cell:willAppearAtIndexPath:, set:

 thumbsCell.thumbSize = kThumbSize;

so the thumbs know what size to be.



回答2:

Another way is to create a category of TTThumbsDataSource Copy the code below into a file ThumbnailDataSource.m and create a similiar headerfile. Include the header file in your TTThumbsViewController subclass. Set kThumbSize to the size you want.

#import <Three20/Three20.h>

@implementation TTThumbsDataSource(ThumbnailDataSource)
- (void)        tableView: (UITableView*)tableView
                     cell: (UITableViewCell*)cell
    willAppearAtIndexPath: (NSIndexPath*)indexPath {
    if ([cell isKindOfClass:[TTThumbsTableViewCell class]]) {
        TTThumbsTableViewCell* thumbsCell = (TTThumbsTableViewCell*)cell;
        thumbsCell.delegate = _delegate;
        thumbsCell.columnCount = [self columnCount];
        thumbsCell.thumbSize = kThumbSize;
    }
}

@end