SDAutoLayout 自己理解

//这个函数是 将 indexPath对应的cache值放入字典中,字典的key为indexPath的值,key对应的object为一个数组,数组里面装的是cell内的所有子控件的frame

//这样就将indexPath 对应的cell的所有子控件的frame都给保存了

- (void)setSubviewFrameCache:(CGRect)rect WithIndexPath:(NSIndexPath *)indexPath
{
    if (!self.subviewFrameCacheDict) {
        self.subviewFrameCacheDict = [NSMutableDictionary new];
    }
    NSString *cacheKey = [NSString stringWithFormat:@"%ld%ld", (long)indexPath.section, (long)indexPath.row];
    NSMutableArray *caches = [self.subviewFrameCacheDict objectForKey:cacheKey];
    if (!caches) {
        caches = [NSMutableArray new];
        [self.subviewFrameCacheDict setValue:caches forKey:cacheKey];
    }
    //一个一个添加
    [caches addObject:[NSValue valueWithCGRect:rect]];
}


你可能感兴趣的:(SDAutoLayout 自己理解)