I have an NSOperation. When it is finished I fire a NSNotificationCenter to let the program know that the NSoperation is finished and to update the gui.
To my understanding listeners to the NSNotification will not run on the main thread because the NSOperation is not on the main thread.
How can I make it so that the listeners run on...
So ... we have this bit of motion detection:
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (event.type == UIEventTypeMotion && event.subtype == UIEventSubtypeMotionShake) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"ShakeBegan" object:self];
}
}
Innocuous enough. We also c...
I'm trying to get one instance of using NSNotificationCenter with addObserver and postNotificationName but I can't work out why it won't work.
I have 2 lines to code to add the observer and send the message in 2 different classes
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(newEventLoaded:) name:@"Event" obj...
Hi
I need a simple example program to send and receive a message through NSNotificationCenter in Objective-C ???
...
Hi,
I have done with a small program to send and receive message, i also wanted to enhance the program by giving muliple events and maintain a NSNotificationQueue?
Please do give me a example..
...
Hi,
I need to create two classes and both should be able to send and receive the events through the NSNotificationCenter methods.ie Both should have the sendEvent and receiveEvent methods:
@implementation Class A
-(void)sendEvent
{
addObserver:--- name:---- object:---
}
-(void)ReceiveEvent
{
postNotificationName: --- object...
I have an iPhone application which basically is getting information from an API (in XML, but maybe JSON eventually). The result objects are typically displayed in view controllers (tables mainly).
Here is the architecture right now.
I have NSOperation classes which fetch the different objects from the remote server. Each of these NSOpe...
I am trying to post a notification without much success! I can do it
ok for the keyboard without issue but now am trying a custom one as
follows:
In my rootview I have this
.h
-(void) allowEdits:(NSNotification *)notification;
.m
//this section is run in method to present the passcode entry form
[[NSNotificationCenter defaultCen...
Hi,
I'd like to reload a table view which is in another class called "WriteIt_MobileAppDelegate" from one of my other classes which is called "Properties". I've tried to do this via the NSNotificationCenter class - the log gets called but the table is never updated.
Properties.h:
[[NSNotificationCenter defaultCenter] postNotification...
I have an application with several UITableViewControllers.
Now, the user is allowed to change "Data source". In that case I need to invalidate (reset) data in the relevant UITableViews.
I figured out, that I can use NSNotificationCenter and add these controllers as observers to events which will be generated when the data source changes...
Hi,
I'm trying to make simple use of the NSNotification center inside my iPhone application, but I seem to be doing something wrong in this case. I was under the impression that it was possible to retrieve an object associated with a particular message, or at least a reference to the object, but using the following example code I'm ge...
Hi all,
I have a class A which is a subclass of uitableviewcontroller and one more class B which actually displays my tableview with its content is a subclass of A.
There's an xml parser which parses my xml and stores the content in an nsmutablearray of application delegate. Now, I fetch this delegate array into a local nsmutablearray ...
This isn't a question so much as a warning to others to save them some time.
NSNotificationCenter on iOS 3/iPhone OS 3 (I'm assuming also Mac OS X and iOS 4) has the following behavior:
If you register yourself multiple times for the exact specific notification, NSNotificationCenter will NOT recognize the redundancy and instead will fi...
This isn't so much a question as a pondering thought - why does NSNotificationCenter throw an exception when it's released? I'm still new to iPhone development, and thus don't know the innards of Cocoa yet, so it'd be good to understand why.
I'm assigning the defaultCenter to a variable, calling addObserver:selector:name:object and then...
Hi,
In my iPad app, in one class I register for a notification:
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(selectedList:) name:@"TTSelectedList" object:nil];
My selectedList: method looks like this:
- (void)selectedList:(NSNotification*)notification
{
NSLog(@"rece...
Hey there, so I've got an NSObject subclass sending out a message via the notification center, and I'm sending out my notifications out to the object nil but the only object that can receive notifications is the one sending them
I've got two notifications being sent out at the same time (to test if it is a threading issue)
[[NSNotif...
Hi,
In my application delegate I have an NSString which can be modified by a class. What I want to do is to have another class observe this NSString and to react whenever this NSString is changed.
Does anybody know how I can do this?
Best regards,
Paul Peelen
...
Hello,
I have a number of text fields on a view controller, when the keyboard appears, it covers some of the text field that are towards the middle of the view controller. Is there a way to move the ViewController up when the keyboard appears.
Stephen
...
Does NSNotificationCenter use pointer equality or some other criteria (like isEqual: or hash:) to determine whether a notification should be sent to an observer?
...
HI,
in my ViewController.m i´ve added a NSNotification in "viewDidLoad" like this:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(pageControlChanged:)
notificationName:@"ScrollViewDidEnd"
object:nil];
Then i´ve a custom scr...