如题 。 代码如下 。如何能在else中调用 self
static void screenLockStateChanged(CFNotificationCenterRef center,void* observer,CFString Ref name,const void* object,CFDictionaryRef userInfo)
{
NSString* lockstate = (__bridge NSString*)name;
if ([lockstate isEqualToString:(__bridge NSString*)NotificationLock]) {
//锁屏
//NSLog(@"locked.");
} else{
//锁屏状态改变
if (b==0) {
b=1;
}
else
{
b = 0;
}
if (b==0) {
c++;
NSLog(@"你打开了屏幕%d次",c);
}
else
{
NSLog(@"你屏幕锁了");
}
}
}