delegates

iPhone Programming - How do I programatically make a view that requires two delegates?

Here is my dilemma. I would like to have a text box and a button. The user types in text and then presses the button. Once the button is pressed, a text message window (using MFMessageComposeViewController) comes up. I don't know how to set this up. The problem is that the TextBox will require a delegate (UITextFieldDelegate) and the MFM...

Question about delegate

Possible Duplicate: C#: Difference between += anEvent and += new EventHandler(anEvent) Let us have this delegate : delegate int Process (int x ,int y) ; and this method : int Add (int x , int y) { return x+y ; } My queston : what is the difference between : Process MyProcess = Add ; and : Process MyProc...

jQuery event delegation for select/options in Chrome

I am trying to bind a simple click event to an the selected option of a pulldown. $('select#myselect').delegate(':selected', 'click', function() { alert('selected'); }); This code works in Firefox, but not Chrome/Safari. Can I use the .delegate() to bind an option for a pulldown menu like this? If so, how? If not, what is...

Implementing nested menus from an xml file using on iphone using multiple delegates--request complete sample code

My problem is that I want to parse an xml file into a hierarchical menu in a series of drilldown tableviews on the iphone. The multiple delegates sample is hard for me to follow as it is a snippet and not a full fleshed out example. Pointers and full-fledged complete samples would be appreciated: I find that this is going to be hard to...

BeginInvoke error

HI, This quetion is in continuation to my question at this link. I wrote an application to compare the approach, used there, with other ways. While running the application in debug mode I got the error "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." on the first BeginInvoke in method Upd...

Why do I get "may not respond to" in my appDelegate file?

Hi, I'm trying to call a method in my appDelegate file and for some reason I get "appDelegate may not respond to splashFade for the code [self splashFade] Here's my code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after ap...

UIScrollView not showing

I have a simple ViewController that looks like this: @interface MyViewController : UIViewController<UIScrollViewDelegate> { UIScrollView *scrollView; UILabel *label; } ... @property stuff ... Now, what I'm trying to do with this Controller is have a ScrollView handle a really large label of text that I have. So in the viewDidLoa...

How to inititalize a UITextView programatically?

How can I initialize a UITextView that is nice and pretty. I have the line: textView = [[UITextView alloc] initWithFrame:CGRectMake(150, 150, 100, 100)]; but I'd like to make it look nice and I do not know the functions or the syntax to do so. I'd like it to have word wraping and I'd like the corners to be rounded. Also, how can I mak...

Changing the text in a UITextView at runtime.

I have a ViewController consisting of just a textView. In its viewDidLoad method, I simply initialize the textView and add it as a subview. In my main ViewController class, when the user presses a button, I switch views and display the view that has the textView. I am trying to change the textView's text however it is not working. Can I ...

Objective C delegate - why specify an instance in the first part of function definition?

I'm confused as to what the first part of the following function declaration means. It adds an object instance as part of the function definition. E.g. In some sample code, class ItemsViewController which derives from UITableViewController has this function definition: -(void) tableView:(UITableView*) aTableView didSelectRowAtIndexPath...

What to do with my data after connectionDidFinishLoading from NSURLRequest

I'm writing a class that uses a JSON API for a website I visit. In my class I use NSURLRequest to fetch the data, but then I need to give the data to the app delegate. I realize NSURLRequest is asynchronous so I can't directly return the data. So let's say in my class, the delegate calls getUserProfile, the method uses NSURLRequest to g...

MGTwitterEngine and Authentication Delegation

Hi. I've been racking my brain for a bit trying figure out what's the cleanest way to handled failed authenication using delegation with the MGTwitterEngine. Is this the correct usage of the connectionIdentifier or just hacked? - (void)initiateCredentialCheckWithUsername:(NSString *)username password:(NSString *)password { self.au...

how to port an application that uses delegates to Java and the Android system

I have an application written in Delphi and ported to C# that makes extensive use of delegates (which allows me to add new modules easily). I think it would make a great Android phone app, but Java does not do delegates natively. I've seen a couple of examples of Java codes that tries to do delegates using reflection, but that does not s...

Calling default handler for UINavigationController

UINavigationController provides with default back button, which will pop the current view controller. I want to add my own handler to the back UIBarButtonItem and after that call the default code so it will pop the controller. I know that I can pop myself in the code, but just wondering if there is a way to call that default routine of f...

Delegates can be used interchangably for Class methods and Static functions?

Like most devs, have been using delegates for many years, and haven't really given them much thought. But I recently got egg on my face by assuming that delegates included a 'this' reference in the signature when referencing a class method. The below example illustrates the gap in my understanding. public class SomeClass { public So...

UITableView not working. Why?

I have a UITableViewController and I have specified the index titles so that the user can skip to specific letters much like the iPod app (the song list, specifically) on an iPhone. I have set up everything and implemented all the methods in the UITableViewProtocol. Now, here is the problem. When I click an index on the right side (they...

Does it make any sence to release ivars in appdelegate's dealloc?

Hi, I know that probably it's a good practice to release appdelegate's ivars in its dealloc method, but practically, does it makes any sence? As I understand the appdelegate of an iPhone app will live in memory while the application is running and all memory will be freed anyway when it's closed. Thank you ...

Func<> and Action<> can't be found

I have a delegate: delegate ResultType Caller<ResultType>(IPtxLogic logic); Here is a function: private ResultType ExecuteLogicMethod2<ResultType>(string sessionId, Caller<ResultType> action) where ResultType : IResult, new() {...} I want to replace the function signature with something like this: private ResultTy...

Relationship between AppDelegate and main.m

Ok, I'm totally new to obj-c + cocoa, so this is probably obvious, but here goes: I've been moving from command line apps to cocoa apps in learning how to work with objective-c in Xcode. One thing I don't really understand is the role of the AppDelegate and how it connects to main.m It seems like you could put your entire program in th...

How can I update a winform asynchronously?

I've got a winform, and a bluetooth connection with a lego nxt brick. Now I want to update the form every second to read sensors or the battery level. But if I start a new thread for that, there i a invalid thread operation exception when the thread wants to set the label text. Can anyone help me? ...