Questions tagged [nsnotification]

NSNotification is a class used to send messages to observing classes through NSNotificationCenter.

NSNotification is a class used to send messages to observing classes through NSNotificationCenter. Notifications must have a name and can be optionally associated with a specific object. If an object is provided, the notification is only delivered to a class that is also observing the exact same name and object.

To send a notification, use NSNotificationCenter's postNotification: (a convenience function postNotificationName:object:userInfo: also exists which creates a notification and posts it with a single call). Classes posting a notification can also include an optional userInfo parameter to pass an object to the receiving class.

For more information, see Apple's documentation for NSNotification and NSNotificationCenter.

312 questions
0
votes
1 answer

Can I call -indexPathsForVisibleRows after scrolling UITableView without subclassing?

After each scroll (however large or small) of a UITableView, I would like to call -indexPathsForVisibleRows to run a method on the data that corresponds to visible cells. Are there any existing notifications or delegate methods I can tap into when a…
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
0
votes
1 answer

strange behavior with postNotificationName with NSDictionary in userInfo

I'm trying to debug a strange problem I'm seeing when passing a NSDictionary as my userInfo in NSNotification using ARC on ios 6. Here's my relevant code: to send the notification: NSDictionary *feedData = [NSJSONSerialization…
debuggrl
  • 35
  • 5
0
votes
2 answers

NSNotification - information not passing through from a different class

I am building a program that utilises NSNotification as I want to be able to pass information through from another class that is going to affect the value of variables in a different class. So, I have set up the following: categories.m class: In…
0
votes
2 answers

NSTimer or NSNotification... which is faster and/or more friendly to iOS system

BTW: This mostly is in reference to iOS 6+: I have an app that -- from many different places in the app -- performs a function that can be backgrounded safely, and is thread safe. I do not wish to stop the system while this function takes place, so…
Jann
  • 2,214
  • 3
  • 28
  • 45
0
votes
4 answers

Is there a simple way to let another ViewController know that a button has been pressed?

I have an app that requires that a menu changes in view controller 1 when a button in view controller 2 is pressed. What is the best way to achieve this? I've heard a lot of talk about NSNotification but I thought that was for displaying alerts?
Jam
  • 33
  • 4
0
votes
1 answer

[NSConcreteNotification isReachable]: unrecognized selector sent to instance

I'm trying to get ASIReachability to work in my app which works when the connection isn't there but when the connection exists it give the following error: 2013-04-08 12:26:20.501 Your Llanelli Companion[1576:207] -[NSConcreteNotification…
0
votes
2 answers

not able to get postnotification to work properly

I am trying to use postnotification but not able to implement it properly. This is what I have : In ViewControllerOne.m NSLog(@"PostNotification"); [[NSNotificationCenter defaultCenter] postNotificationName:@"Connectivity" object:nil]; In…
lakshmen
  • 28,346
  • 66
  • 178
  • 276
0
votes
1 answer

Trying to call multiple viewControllers one at a time via NSNotifications in iOS

I have an application that I am working on that has several viewControllers, with each one displaying a single test for the user to do. At the moment, the user is able to go through each one individually. However, I am trying to implement a…
syedfa
  • 2,801
  • 1
  • 41
  • 74
0
votes
1 answer

Using iOS GCD and NotificationCenter to alert user when asynch data load is complete (async load of several datasets one at a time)

I am writing an iPad App in which I load data for a multi-storied building asynchronously. I have set up NSNotifications to alert the user once data-load for all floors is complete. The data load for each floor is kicked off in a loop when a load…
0
votes
1 answer

Is there a way to recognise from which application NSNotification / NSEvent came?

I have started listening to global keyDown events. Is there a way to get information from which application that event came? A handler receives NSNotification instance and NSEvent is part of it. Can I somehow extract that information from those…
0
votes
1 answer

Core Data NSNotification in awakeFromFetch Causing Crash

I'm sure someone's seen this before and I'm probably missing something obvious... Here's the brief rundown: I have a Core Data app, it has Car and CarMileage, which is more accurately thought of as a car trip (Car <-->>CarMileage). CarMileage…
0
votes
1 answer

Is there a way to access the notifications shown in the notification center?

I have kind of to-do local notifications that are fired OK. So for example if 2 notifications have fired the badge number goes to 2. Now I like to handle these notifictaions also when the user just starts the app directly - not via the notifictaion…
user387184
  • 10,953
  • 12
  • 77
  • 147
0
votes
1 answer

NSNotificationCenter AppDelegate post notification problems

My application performs a series of processing methods once a day or when a local notification is received to perform the series of tasks and is working as expected. I tried adding an ActivityIndicator to a view that begins animating when a…
0
votes
1 answer

Is it necessary to Remove viewController as observer during an edit in an iCloud app?

Take the example of two iOS device running the same app that has iCloud support. The app has CoreData and is "Library" style, not a multiple document style app. User A is adding an object using the interface and during this addition user B saves the…
mbarron
  • 285
  • 4
  • 15
0
votes
1 answer

Is there a way to limit NSNotification?

I use NSNotification to send notification when switch is changed position to start updating annotations on map. My problem is that I have 8 switches and when user change position of few switches, map updates for many times. How a limit that to just…
Pavel Kaljunen
  • 1,291
  • 2
  • 26
  • 53
1 2 3
20
21