小编nao*_*1ta的帖子

卸载我的Android应用程序之前如何做某事?

我发现了如何检测卸载事件并测试以下代码.

Receiver.java中:

    @Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    Log.d(TAG, "received broadcast : " + action);
}
Run Code Online (Sandbox Code Playgroud)

manifest.xml中:

<receiver android:name="....base.BaseAppReceiver">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REMOVED"/>
                <data android:scheme="package"/> 
            </intent-filter>
        </receiver>
Run Code Online (Sandbox Code Playgroud)

但它只检测到其他应用程序何时被卸载.我想在卸载"我的"应用程序而不是"其他"应用程序之前做一些事情.请让我知道如果可以,我的应用程序如何检测卸载事件以便在卸载我的应用程序之前处理某些内容.

android uninstall broadcastreceiver

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

如何在UICollectionView上设置渐变固定背景?

我使用以下代码.

CAGradientLayer* collectionRadient = [CAGradientLayer layer];
collectionRadient.bounds = self.collectionView.bounds;
collectionRadient.anchorPoint = CGPointZero;
collectionRadient.colors = [NSArray arrayWithObjects:(id)[startColor CGColor],(id)[endColor CGColor], nil];
[self.collectionView.layer insertSublayer:collectionRadient atIndex:0];
Run Code Online (Sandbox Code Playgroud)

但它在包含图像的细胞上绘制.所以没有显示细胞.

我想在Cells下绘制UICollectionView的渐变背景,并在滚动视图时修复它.请告诉我.

gradient objective-c ios uicollectionview

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