十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
使用第三方 : QuiltView (可在cocoapods上找到)
成都创新互联坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站设计制作、成都网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的临潭网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!.h 文件
#import#import "TMQuiltView.h" #import "TMPhotoQuiltViewCell.h" @interface SelfHomeViewController : UIViewController { } @property(strong,nonatomic)TMQuiltView *quiltView; @property(strong,nonatomic)NSArray *p_w_picpaths; @end
.m 文件
主要代码:
#define kNumberOfCells 50 - (void)dealloc { [_quiltView release]; _quiltView = nil; [_p_w_picpaths release]; _p_w_picpaths = nil; [super dealloc]; } - (void)viewDidLoad { [super viewDidLoad]; _quiltView = [[TMQuiltView alloc] initWithFrame:self.view.bounds]; _quiltView.dataSource = self; _quiltView.delegate = self; [self.view addSubview:_quiltView]; [_quiltView reloadData]; } #pragma mark - QuiltViewControllerDataSource - (NSArray *)p_w_picpaths { if (!_p_w_picpaths) { NSMutableArray *p_w_picpathNames = [NSMutableArray array]; for(int i = 0; i < kNumberOfCells; i++) { [p_w_picpathNames addObject:[NSString stringWithFormat:@"%d.jpeg", i % 10 + 1]]; } _p_w_picpaths = [p_w_picpathNames retain]; } return _p_w_picpaths; } - (UIImage *)p_w_picpathAtIndexPath:(NSIndexPath *)indexPath { return [UIImage p_w_picpathNamed:[self.p_w_picpaths objectAtIndex:indexPath.row]]; } - (NSInteger)quiltViewNumberOfCells:(TMQuiltView *)TMQuiltView { return [self.p_w_picpaths count]; } - (TMQuiltViewCell *)quiltView:(TMQuiltView *)quiltView cellAtIndexPath:(NSIndexPath *)indexPath { TMPhotoQuiltViewCell *cell = (TMPhotoQuiltViewCell *)[quiltView dequeueReusableCellWithReuseIdentifier:@"PhotoCell"]; if (!cell) { cell = [[[TMPhotoQuiltViewCell alloc] initWithReuseIdentifier:@"PhotoCell"] autorelease]; } cell.photoView.p_w_picpath = [self p_w_picpathAtIndexPath:indexPath]; cell.titleLabel.text = [NSString stringWithFormat:@"%d", indexPath.row + 1]; return cell; } #pragma mark - TMQuiltViewDelegate - (NSInteger)quiltViewNumberOfColumns:(TMQuiltView *)quiltView { return 3; } - (CGFloat)quiltView:(TMQuiltView *)quiltView heightForCellAtIndexPath:(NSIndexPath *)indexPath { return [self p_w_picpathAtIndexPath:indexPath].size.height / [self quiltViewNumberOfColumns:quiltView]; }附件:http://down.51cto.com/data/2364898
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。