English 中文(简体)
NS 通知 中心 观察员未作出答复
原标题:NSNotificationCenter addObserver not responding

在我看来(加梅),当中心/家庭或锁托顿受到压力时,我试图利用国家核电中心停下来,恢复游戏。 使用:

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(pauseLayer:)
 name:UIApplicationWillResignActiveNotification
 object:self.view.layer.sublayers];

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(pauseLayer:)
 name:UIApplicationDidEnterBackgroundNotification
 object:self.view.layer.sublayers];

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(resumeLayer:)
 name:UIApplicationWillEnterForegroundNotification
 object:self.view.layer.sublayers];

我已尝试将其放在不同地方的很多地方,如GeoDidLoad, 视DidAppear, InitWith NibNameOrNil, 但这些地方虽然都被叫了起来,但不管用什么手法,还是没有叫pa。 为什么这一法典发挥作用?

最佳回答

更改<条码> 电话和删除<代码>自.view.layer.sublayers 载于object param。 改为nil

EDIT:更多信息

Sure。 www.un.org/Depts/DGACM/index_french.htm 第2段请标注如下: 请具体说明<代码>。 您仅通过<代码>代谢/代码>阵列发送。 当然,<代码>代谢/代码>阵列没有发出这一通知。 请具体说明<代码>目标:nil 您正在观察任何物体的通知。 在本案中是适当的。 如果你想具体指明一个物体,则将采用<条码>[共同申请]

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签