终极暗黑2存档编辑器指南:5分钟打造完美游戏体验
2026/6/5 23:38:52
在开发过程中,页面更新是一个常见的需求。以下是实现页面更新的代码:
- (void) updatePages { int pageNumber = imagesContainer.contentOffset.x / imagesContainer.bounds.size.width + 1; // Load the image previous to this one [self loadPageWithNumber:pageNumber - 1]; // Load the current page [self loadPageWithNumber:pageNumber]; // Load the next page [self loadPageWithNumber:pageNumber+1]; // Remove all image views that aren't on this page or the pages adjacent // to it for (UIImageView* imageView in imagesContainer.subviews) { if (imageView.tag < pageNumber - 1 || imageView.tag > pageNumber + 1) [imageView removeFromSuperview]; }