iOS开发中的页面更新、内存管理、调试与数据共享
1. 页面更新
在iOS开发中,页面更新是一个常见的需求。以下是一个用于更新页面的方法:
- (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];
}
}
超级会员免费看
订阅专栏 解锁全文
855

被折叠的 条评论
为什么被折叠?



