delegates Questions

9

Solved

I`m having some trouble in understanding how delegates in C# work. I have many code examples, but i still could not grasp it properly. Can someone explain it to me in "plain english"? Of course! e...
Allene asked 14/11, 2009 at 18:55

6

Solved

I was reading the Essential C# 3.0 book and am wondering if this is a good way to check delegates for null?: class Thermostat { public delegate void TemperatureChangeHandler ( float newTemperatur...
Archiphoneme asked 9/6, 2009 at 23:1

5

I have a webview which shows an html file. When the user scrolls to the bottom of this file in webview, I want a button that was previously hidden to show up, which the user can then press to do so...
Marilla asked 8/6, 2012 at 21:51

1

Solved

How can I pass e.g 2 strings to Func and return a string? Let say I would like to pass FirstName and LastName and the result should be like FirstName + LastName; Moreover, I would like to have a F...
Clown asked 1/11, 2017 at 19:50

15

Solved

As a C# developer I'm used to running through constructors: class Test { public Test() { DoSomething(); } public Test(int count) : this() { DoSomethingWithCount(count); } public Test(in...
Eldwun asked 21/11, 2008 at 9:43

2

Solved

I am currently running into an issue trying to create delegates from MethodInfo. My overall goal is to look through the methods in a class and create delegates for ones marked with a certain attrib...
Prophylaxis asked 20/6, 2012 at 13:13

3

Solved

I've noticed that the Delegate class has a Target property, that (presumably) returns the instance the delegate method will execute on. I want to do something like this: void PossiblyExecuteDelega...
Karenkarena asked 4/6, 2009 at 16:23

5

Solved

I'm incurred in a little problem customizing my cell; as you can see the separator line do not reach the left border of the cell, and a I'd like to do it. I found these: Separator lines for UITab...
Seavey asked 24/8, 2015 at 9:22

3

Solved

I have some VERY inefficient code in which many lines appear 4 times as I go through permutations with "<" and ">" operations and a variety of variables and constants. It would seem that there i...
Taiga asked 27/7, 2009 at 19:17

2

Solved

Is there a UITableView delegate-action that runs when the tableView is being scrolled? This is probably really easy, but I can't find it. Thank you :)
Loreeloreen asked 19/8, 2010 at 10:35

4

I want to have a listener of sorts that reports whenever a new UIViewController is pushed. I can achieve this by subclassing from a single class and then listening in super viewDidLoad/viewDidAppea...
Horripilation asked 26/9, 2017 at 2:46

4

Solved

I have created objects that are interfaces to a web service. One typical object would be a "TaskService". When a client uses one of these objects, it invokes one of the service's methods (such as "...
Pitterpatter asked 31/1, 2012 at 22:28

4

Solved

I'm having problems setting up the TTTAttributedLabel within my project. I have set the protocol delegate in my header file @interface TwitterFeedControlleriPad : UIViewController <TTTAttribu...
Grimona asked 22/7, 2013 at 20:10

1

Solved

Is there a simple way get a delegated property by lazy's value computed per thread like ThreadLocal? LazyThreadSafetyMode controls concurrent initialization, with .NONE coming close to the desire...
Jemmie asked 30/8, 2017 at 22:39

7

Solved

I have read a lot about the pros and cons of each, and I know delegates are usually for one listener, and notifications are for many. The question is about performance. I have read NSNotificationCe...

6

Solved

In C# you can define delegates anonymously (even though they are nothing more than syntactic sugar). For example, I can do this: public string DoSomething(Func<string, string> someDelegate) ...
Grilled asked 27/8, 2009 at 10:38

3

Solved

Is there a way I can get the button click event from a button inside a UICollectionViewCell? I used a nib to populate the collection view, the cell has the button but its action is not getting call...
Aaronaaronic asked 20/12, 2012 at 6:9

1

Solved

I'm navigating the ins and outs of ref returns, and am having trouble emitting a dynamic method which returns by ref. Handcrafted lambdas and existing methods work as expected: class Widget { pu...
Prelacy asked 26/7, 2017 at 0:57

2

Solved

I'd like to be able to generically pass a function to a function in C. I've used C for a few years, and I'm aware of the barriers to implementing proper closures and higher-order functions. It's al...
Toandfro asked 15/1, 2013 at 5:52

2

Solved

This is my first iOS development and so I am using this tiny project to learn how the system works and how the language (swift) works too. I am trying to make a drawer menu similar to android app ...
Sidesman asked 13/7, 2017 at 9:3

2

Solved

I know that you can't use the delegated property syntax in Java, and won't get the convenience of "overriding" the set/get operators as in Kotlin, but I'd still like to use an existing property del...
Warnerwarning asked 17/7, 2017 at 23:53

2

Solved

I'm new to Kotlin. When I learn Storing Properties in a Map. I try following usage. class User(val map: MutableMap<String, String>) { val name: String by map } class User(val map: Mutab...
Arginine asked 21/6, 2017 at 1:27

3

Solved

If you know Google's experimental Android Architecture Components, you probably know MutableLiveData. Trying to make it a bit more fun to use I came with: class KotlinLiveData<T>(val default...
Tepper asked 30/6, 2017 at 11:3

3

Solved

I have two objects, both of which are view controllers. The first (Ill call it viewController1) declares a protocol. The second (which unsurprisingly I will name viewController2) conforms to this p...
Penumbra asked 15/4, 2012 at 9:25

2

Solved

How can I pass a predicate into a method but also have it work if no predicate is passed? I thought maybe something like this, but it doesn't seem to be correct. private bool NoFilter() { return t...
Clyte asked 26/6, 2017 at 13:53

© 2022 - 2024 — McMap. All rights reserved.