delegates

how can use Delegate methods

hello all i m try to use a delegate method in my simple iphone application but i got a error. if there are any example code. pls send me link or code. ...

iPhone: modalview not closing

I have a function, in UpdateViewController, that is being called by a delegate, MyDownloadController, that will close a modal view (which is the UpdateViewController). -(void)errorDownloading { self.downloadController.delegate = nil; [downloadController release]; [self dismissModalViewControllerAnimated:YES]; } I've trie...

How to refresh UITableView data?

I have a UITableView with two sections, which are both empty when my application launches. My app fetches the data from a URL, then puts the data into arrays (one per section) which should be used to supply the UITableView data for each cell. Calling [tableView reloadData] doesn't seem to refresh any of the data, or call any of the dele...

Getting iPhone app to display one of two different views

I have a program where we are using a navigation controller and need the app to launch to one of two different views. Basically if certain info has previously been entered then we need the app to launch to view A, but if the info has never been entered then we need it to launch to view B. I am having difficulty getting this to work and a...

Property changes but I can't figure out who's doing it.

I have a UIViewController (called AdjustViewController) that presents another UIViewController (called SourcePickerViewController) with a UIPickerView modally. I generate instances of the AdjustViewController and they in turn make a SourcePickerViewController. I make an NSDictionary and assign it and an integer to the AdjustViewControl...

Creating an expression tree that calls a method

Is it possible to create an expression tree that directly calls a method? For example, consider the following method: public static int MyFunc(int a, int b) { return a + b; } I would like to create an expression tree that calls MyFunc with parameters a=1 and b=2. One way to accomplish this is with reflection: var c1 = Expression....

What method is called when iPhone is locked?

I want my app to stop locating the user when the app is open, but the phone is locked, to cut down on battery usage. What delegate method is called when the user locks the phone while an app is still running and active? ...

Why I cannot use the anonymous method like that?

Hi, Why can't I have this? I mean it would spare a delegate declaration: int X=delegate int(){...}; I know it can be done this way: delegate int IntDelegate(); ... IntDelegate del=delegate(){return 25;}; int X=del(); ...

C# delegate dictionary add

I want to create a method like this: private static void AddOrAppend<K>(this Dictionary<K, MulticastDelegate> firstList, K key, MulticastDelegate newFunc) { if (!firstList.ContainsKey(key)) { firstList.Add(key, newFunc); } else { firstList[key] += newFunc; // this line fails } } But this fails ...

How to access delegate returned parameters outside of the delegate method?

I've got a UIViewController with a UIPicker on it and I've got the - (void)sourcePickerViewController:(SourcePickerViewController *)controller etc... which returns several bits of data (the etc...) to it's delegate. Inside the delegate method, I see the values I want and can output them via NSLog but I can't figure out how to use them e...

textview not responding to delegates iphone

Hi all, In my application, I'm forcefully showing/hiding keyboard by making textview becomefirstresponder and resignfirstresponder and also setting textview editable YES and NO respectively. But after hiding keyboard if I tap on textview, the keyboard doesn't show up. I'm setting textview delegate to self. And the delegate method is fi...

Why are my properties `out of scope`?

I have a method to generate some strings based on the values of some variables I get from I picker controller that is presented modally. I get the values back in the delegate method fine and I can assign them to some properties in my view controller successfully. When I call my method to do the updating, I send the values to the consol...

Getting navigation controller to launch one of two different views

I have a program where we are using a navigation controller and need the app to launch to one of two different views. Basically if certain info has previously been entered then we need the app to launch to view A, but if the info has never been entered then we need it to launch to view B. I am having difficulty getting this to work and a...

Getting black screen when loading navigation controller

The following code below is attempting to implement a method where my navigation controller launches to on e of two different views. The problem is that I keep getting a black screen whenever my application launches. #import "SugarCRMReleaseOneAppDelegate.h" #import "SettingsViewController.h" #import "ModuleViewController.h" @implemen...

Universal iPhone/iPad appDelegates

When creating a new project (universal iPhone/iPad) using Core Data, there's the usual appDelegate which creates the ManagedObject Model/Context etc., then there are the two subclasses of the appDelegate (one for each device). I can't seem to call the moc from the subclasses (using [super managedObjectContext]). Could someone enlighten m...

Do empty delegates not get invoked?

Hi, In .NET, when you have a delegate that only has an empty method subscribed to it, does the .NET VM realize this and skip even calling it? I'm asking because I noticed that the invocation count is set to 2 when you subscribe once but when you unsubscribe it, the value goes down to 0 (not 1). Thanks in advance. Daisuke ...

iPhone: NSFetchedResultsController with delegate and data update from a separate thread

Hi all! First of all, sorry for the too long question. I know that there are few questions here that discuss similar issues but none of these talks about NSFetchedResultsController with delegate together with update in separate thread. And none of the solutions has helped me. These are the existing questions: NSFetchedResultsControll...

XNA - Object Movement (?) gradually slowing down the game

Hello! I'm currently making a 2D game using XNA. I've made a class named GL_Object that contains my objects data (Sprite, Position, etc), and also contains a GL_Path object. GL_Path contains a GL_Motion. This GL_Motion object contains a list of GL_Movement objects. GL_Movement is a interface which holds two main methods, "ProcessMove",...

NSFetchedResultsChangeDelete not being triggered

Has anyone run into this before? When I choose to delete a row from my tableView (populated by an FRC), the app doesn't crash or hang. It doesn't do anything. The delete button stays selected and if I click elsewhere on the simulator, the delete button deselects and disappears, but the cell is never removed form the UI. I'm sure there i...

How to have multiple delegates for an object without giving the object too much domain knowledge?

The setup: I have a singleton data access manager object, call it Manager. I also have some view controllers, call them Apples and Oranges. Both Apples and Oranges use Manager for some shared data model/access functionality. I would like Manager to call either of them back in certain cases according to something like this: if (someCond...