Edit: Please note the question below discusses using delegation between 2 viewcontrollers that are also implemented in a UITabBarController. I've done a fair bit of searching here and on YouTube, but haven't seen my issue replicated elsewhere. I'll k
ViewController Code class ViewController: UIViewController { deinit { print("ViewController deinitialised") } @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { self.tableView.dataSource = self } func didTapBlue() { } } ext
I create an os X project and use Main Menu to open file directory and show the contents on tableview. In my AppDelegate.swift: class AppDelegate: NSObject, NSApplicationDelegate { var filePath: String = String() { didSet { // Pass filePath to ViewCon
I used to think that the default/implicit specifier for protocol methods is optional. However, in my current project I see a warning if I do not add the @optional specifier specifically. Not a big deal. I am just wondering, was it optional the defaul
I'm trying to learn how delegates work and wrap my head around the concept. I'm finding I get some of the ideas. I understand you use it to pass data from one view controller to another, however wouldn't it work the same if I just sent data from a se
In a client application, I am using an asynchronous WCF method being called from the following code: public void doActiveDx() { this.dataservice.GetActiveDxCompleted += (s,e) => { ...do something... }; this.dataservice.GetActiveDxAsync( ); } Why is t
I have an ImagePickerController in my application. It works well, but beside ipc.delegate = self; there appears an error message: Assigning to 'id' from incompatible type 'ViewController *const__strong' The app workes well, so I ignored the error mes
I'm using the MSDN examples for variance in delegate. But the following code is giving me a compilation error. Based on my understanding, it should accept the First as an argument. What am I doing wrong? The code sample. SampleGenericDelegate<Second,
For a project I need to be able to send a status back from "secondTableViewController" to "firstTableViewController". I followed some tutorials on delegates but I don't seem to get it to work. When I want to call the method in firstTab
Consider this code: switch (number) { case 1: Number = (int)SmsStatusEnum.Sent; break; case 2: Number = (int)SmsStatusEnum.Delivered; break; case 3: Number = (int)SmsStatusEnum.Failed; break; default: Number = (int)SmsStatusEnum.Failed; break; } retu
Here's my problem. I created a view controller and I inserted a table view(with a cell) in it. I have also a text field at the bottom of the view controller. The aim is to put in the cell the text I wrote in the text field. I tried a lot of things bu
I am writing a networked application. My model objects contain delegates that are called when a value changes. I have network objects that use the delegates to send the changed value over the network: Model: public class Person : AbstractModel { publ
I have read around, and it seems as though delegates would be really useful in my app. Unfortunately, every tutorial about protocols I have tried has failed - the delegate is not receiving the message! It would be great if someone could tell me what
I was translating some C++ code to C# and there was a function pointer within a structure definition, say func* This func* was a pointer to a lot of other function pointers all contained within a C++ header file (This header file won't be translated)
In my app delegate I have one object that I need to use in some different 3 viewControllers. To use it I do in the interface NewsPadAppDelegateiPad *delegate; and in the implementation I do delegate = (NewsPadAppDelegateiPad *)[[UIApplication sharedA
I would like to declare / define my delegate and callback function inside of the calling method. Is that possible ? If yes how ? This is my code that I want to execute my first implant operation on: delegate bool myDelegate(IntPtr module, string type
I'm trying, unsuccessfully, to enumerate through a List<Func<InstagramUser,bool>> to filter a collection of List<InstagramUser>. My code compiles, but just returns the whole list, unfiltered, when display() is invoked. My question is, wh
I am using jQuery to attach a function to my click event for an entire class. For example: $(".clickDiv").click(function(){ $(this).hide(); }); On my client-side javascript, I create more .clickDiv instances dynamically. Do I need to call the $(
I am having a very, very strange error, probably related to memory management (even though I'm using ARC). I have a my AppDelegate, Foo, and SubFoo (which is a subclass of Foo). Foo.h @protocol FooDelegate <NSObject> - (void)didReceiveDownloadReques
Possible Duplicate: Why does asynchronous delegate method require calling EndInvoke? Is Delegate.EndInvoke() really necessary? Working on a multi-threaded application at the moment and when raising an event instead of doing the normal handler.Invoke(
Take the following: var x = new Action(() => { Console.Write("") ; }); var y = new Action(() => { }); var a = x.GetHashCode(); var b = y.GetHashCode(); Console.WriteLine(a == b); Console.WriteLine(x == y); This will print: True False Why i
I am working with Windows Forms, and many times have bumped into (as I understood it) the necessity to write wrapping functions around properties of the UI components, so that they (the properties) could be set from another thread by invoking their w
I have created the following function: public void DelegatedCall(Action<Object> delegatedMethod) And defined the following method public void foo1(String str) { } However, when I try to call DelegateCall with foo1: DelegatedCall(foo1); ...I get the
I have set up JQuery UI autocomplete according to the docs and it works for any input with class="tag-item" that is rendered to the page. However the user can add inputs into the dom via JS so I need a way to bind autocomplete to the new dynamic
I'm able to assign a method M to delegate object d with a less specific parameter type, but when I want to assign an anonymous method with same the signature as method M to d, I get an error. Why is that? class derivedEventArgs : EventArgs { } delega
I've created a Delegate that I intend to call Async. Module Level Delegate Sub GetPartListDataFromServer(ByVal dvOriginal As DataView, ByVal ProgramID As Integer) Dim dlgGetPartList As GetPartListDataFromServer The following code I use in a method Di
Is it possible to use delegate in your Active Record model and use conditions like :if on it? class User < ApplicationRecord delegate :company, :to => :master, :if => :has_master? belongs_to :master, :class_name => "User" def has_mas
For instance... if i have a method that performs some asynchronous operation and i want to notify/call some sort of callback once it's done, would i use delegate? I can't seem to get my head round how that would work. Can anyone point me in the right
I'm trying to create a form that will animate something while processing a particular task (passed as a delegate to the constructor). It's working fine, but the problem I'm having is that I can't instantiate a copy of my generic class if the particul
I'm using C#. So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects. List<MyObject> myObjects = new List<MyObject>(); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myO