小编Boa*_*ssi的帖子

检测iOS UICollectionCell何时离开屏幕

我有一个UICollectionView将图片作为其数据存储区中的元素.

我想将高分辨率pic加载到元素中,只有当它的对应UICollectionViewCell当前显示在屏幕上时.之后,当UICollectionViewCell屏幕关闭时,我想将元素返回UIImage到低分辨率版本.

我的问题是,如何检测UICollectionViewCell屏幕何时关闭?

(我尝试使用该prepareForReuse方法,但我无法预测何时会被调用).

我目前正在使用一段代码,scrollViewDidScroll每次视图滚动时我都会检查self.collectionView.visibleCells以查看哪些单元格已在屏幕上滚动.

这看起来有点开销,我想知道UICollectionViewCell在滚动屏幕的时候是否有自己调用的方法?

ios uicollectionview uicollectionviewcell uicollectionreusableview

10
推荐指数
2
解决办法
6065
查看次数

GMSGeocoder - 如何设置响应语言

在国外使用我的应用程序时,谷歌GMSGeocoder会自动以本地语言返回响应.如何将其设置为始终以英语返回响应?

我使用GMS SDK 1.7,我的代码是这样的:

GMSGeocoder *geoCoder = [[GMSGeocoder alloc] init];


[geoCoder reverseGeocodeCoordinate:self.cellLocation.coordinate completionHandler:^(GMSReverseGeocodeResponse *respones, NSError *err) {
    if([respones firstResult]) {

        GMSAddress* address = [respones firstResult];
        NSString* fullAddress = [NSString stringWithFormat:@"%@, %@",address.thoroughfare, address.locality];

        self.theTextField.text = fullAddress; 

    } else {
        self.theTextField.text = @"";
    }
}];
Run Code Online (Sandbox Code Playgroud)

geocoding ios gmsmapview

10
推荐指数
1
解决办法
2623
查看次数

是否可以将不同大小的部分页脚添加到同一uicollectionview的不同部分

我有一个uicollectionview包含2个部分,我想为每个部分添加一个不同大小的页脚.从IB我看到我每个集合只能添加一个页脚和标题.

如果我会注册2个不同的页脚,是否可能通过代码?或者可以在每个部分的运行时间中更改页脚的大小?

footer uicollectionview

1
推荐指数
1
解决办法
1924
查看次数