Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVO的监听与移除 #6

Open
sunshineLixun opened this issue Mar 22, 2017 · 0 comments
Open

KVO的监听与移除 #6

sunshineLixun opened this issue Mar 22, 2017 · 0 comments

Comments

@sunshineLixun
Copy link

sunshineLixun commented Mar 22, 2017

Hello! 最近在看您写的MVCS框架 ,KVO模块有个地方不太理解:
[info.observedObject removeObserver:info.observingObject forKeyPath:info.keyPath]; 既然已经移除了kvo 。那下面这段代码看着不是很懂:

        NSObject *otherObject = nil;
        if (info.observedObject != registeredObject) {
            otherObject = info.observedObject;
        } else if (info.observingObject != registeredObject) {
            otherObject = info.observingObject;
        }
        
        NSMutableArray *infosForOtherObject = [otherObject mi_associatedObjectForKey:kMIKVOInfoKey];
        [infosForOtherObject removeObject:info];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant