我的UICollectionView单元格包含带有多行文本的UILabel.在标签上设置文本之前,我不知道单元格的高度.
-(CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
Run Code Online (Sandbox Code Playgroud)
这是我查看细胞大小的初始方法.但是,这是在故事板之外创建单元格之前调用的.
有没有办法布置集合并在细胞渲染后调整大小,我知道细胞的实际大小?
我正在使用knox(https://github.com/LearnBoost/knox)将文件上传到Amazon S3.我刚刚将我的节点应用程序移动到Amazon EC2,并在使用knox上传时出现以下错误.我似乎安装了所有库.nodejitsu上的代码相同.我对node/JS很新,所以我不确定这意味着什么.
/home/ec2-user/foo/node_modules/knox/lib/auth.js:208
Object.keys(url.query).forEach(function (key) {
^
TypeError: Object.keys called on non-object
at Function.keys (native)
at Object.exports.canonicalizeResource (/home/ec2-user/foo/node_modules/knox/lib/auth.js:208:10)
at Client.request (/home/ec2-user/foo/node_modules/knox/lib/client.js:275:22)
at Client.put (/home/ec2-user/foo/node_modules/knox/lib/client.js:326:15)
at Client.putStream (/home/ec2-user/foo/node_modules/knox/lib/client.js:408:18)
at /home/ec2-user/foo/node_modules/knox/lib/client.js:378:20
at Object.oncomplete (fs.js:93:15)
Run Code Online (Sandbox Code Playgroud) 我想以UICollectionViewCell
编程方式滚动到一个单元格后得到一个位置.我正在设置这样的滚动位置.
[self.collectionView scrollToItemAtIndexPath:indexPath
atScrollPosition:UICollectionViewScrollPositionCenteredVertically
animated:NO];
Run Code Online (Sandbox Code Playgroud)
然后我想得到我滚动到的单元格的框架,因为我需要UIView
在它附近放置另一个.
此代码返回带有scrollview的单元格的rect,但我需要在可见rect中的位置.
UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForItemAtIndexPath:indexPath];
CGRect cellRect = attributes.frame;
Run Code Online (Sandbox Code Playgroud)