delegates

Does calling a protocol method pass program flow control?

I know this is quite possibly a lame question, but I've pulled three consecutive all-nighters and I'm very blurry. And I'm new to Objective C and Cocoa Touch. I've created a class that provides a delegate method. I'll use simplified example code since the specifics aren't important. The header file looks like this: #import <Foundation/...

How to convert delegate to identical delegate?

There are two descriptions of the delegate: first, in a third-party assembly: public delegate void ClickMenuItem (object sender, EventArgs e) second, the standard: public delegate void EventHandler (object sender, EventArgs e); I'm trying to write a method that will receive a parameter of type EventHandler and will call third-party...

Collision detection delegate scheme

Hey guys! My physics engine is coming along quite nicely (thanks for asking!) and I'm ready to start working on some even more advanced junk. Case in point, I'm trying to set up my collision engine so that an arbitrary delegate can be notified when a collision occurs. Let me set up a scenario for you: Say we have object A, object B, ...

Delegates and protocols objective c

Hi, I followed on some advice given on this very forum and I am still having difficulty I have the following: #import <UIKit/UIKit.h> @protocol UIViewForWheelProtocol - (void) returnImageNumber:(int)imgNum; @end #import <UIKit/UIKit.h> #import "UIViewForWheelProtocol.h"; @interface UIViewForWheel : ...

NSFetchedResultsController delegate methods won't be called after rearranging table rows

hi all i wonder why the delegate methods of NSFetchedResultsController won't be called after i reorder table rows. my problem is that rows disappear when i rearrange them in my tableview with the method - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath so ...

NSSpeechSynthesizer delegate method always reports an error, but which one?

I have the following delegate method for NSSpeechSynthesizer: - (void) speechSynthesizer:(NSSpeechSynthesizer *)sender didFinishSpeaking:(BOOL) success { NSLog(@"Finished correctly = %d", success); [startButton setEnabled:YES]; [stopButton setEnabled:NO]; } The parameter "success" is always NO, even though I heard everyth...

How to make sure your delegate(iphone, cocoa) is thread safe?

Hi I've seen a few examples of using delegate with multiple threads for async image loading with cocoa's URL loading system. I think the process goes like below. Thread 1 : give thread 2 an operation to perform, and a delegate which thread 2 will access upon completion. Thread 2 : upon completing the operation, calls a predefined se...

C# Create a Delegate that fires an event?

Is it possible to use Reflection is C# to fire an event? Say I have a situation like this: public delegate void SomeEventHandler(object sender, BenArgs e); class EventHub { public event SomeEventHandler SOME_EVENT; public void fireEvent(String eventName) { SomeEventHandler evt = (SomeEventHandler) Delegate.CreateDe...

how to avoid that callback is sent to deallocated instance

The following process leads to a crash of my app: the user opens a view and a request is send to the server the request is executed in background the user navigates back to the root view the request has been finished and the following code is executed // MyDatasource.m // e.g. in connectionDidFinishLoading [callback loaded...

Trashed properties in Application Delegate.

I'm in deep trouble. Something in my app causes a lot of properties in my app delegate to become trashed (changing contents and even object type, say an NSArray becomes an NSString...), and I can't debug it out. I can find no memory leaks or errors on my part. The only thing I've found is that all the way to ViewDidAppear for the view of...

Can I use params in Action or Func delegates?

When I'm trying to use params in an Action delegate... private Action<string, params object[]> WriteToLogCallBack; I received this design time error: Invalid token 'params' in class, struct, or interface member declaration Any help! ...

C# Problem setting Label Content in WPF App From Separate Thread

I have a window that contains a label (player1). I also have a class that gathers data asynchronously in the background inside a thread. When that data has been gathered, I want to changed the content of my label. Since the label was created by the UI and I'm trying to edit it from another thread, I tried using Dispatcher. However, after...