delegates

Swift, for some UIViews to their overall controller when clicked

此生再无相见时 提交于 2019-12-19 11:30:32
问题 I have a DotBoss:UIViewController There are a dozen UIView in the scene, Dot:UIView (Some are direct subviews, some are further down.) There are even container views in the chain between the highest controller and the Dot items. The dozen Dot items know if they are tapped... class Dot:UIView { private var tap:UITapGestureRecognizer? = nil override func awakeFromNib() { tap = UITapGestureRecognizer(target:self, action: #selector(SnapDot.handleTap(_:))) self.addGestureRecognizer(tap!) } func

C#: Asynchronous delegates vs ThreadPool.QueueUserWorkItem when initiating many connections

 ̄綄美尐妖づ 提交于 2019-12-19 10:49:19
问题 I have to send many web service calls out to delete a bunch of records in Amazon SDB (unfortunately, rows can only be deleted one at at time currently). I am using Amazon's SDB c# library which does not use async WebRequests. Currently I use ThreadPool.QueueUserWorkItem to queue up a bunch of calls (I configured my connectionManagement maxconnection to allow for a bunch of connections) this works well..as the request is sent out, it blocks and another request is made. Is this the wrong way to

NSTokenField does not let me type other strings than tokenField:completionsForSubstring:… returns

烈酒焚心 提交于 2019-12-19 09:58:12
问题 My issue is that NSTokenField does not allow me to type any text I want, it's only allow me to type strings that are included in the NSArray that tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem: returns. - (NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex { return [NSArray arrayWithObjects:@"AA", @"BB", @"CC", @"DD", nil]; } My NSTokenField can

NSTokenField does not let me type other strings than tokenField:completionsForSubstring:… returns

岁酱吖の 提交于 2019-12-19 09:58:08
问题 My issue is that NSTokenField does not allow me to type any text I want, it's only allow me to type strings that are included in the NSArray that tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem: returns. - (NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex { return [NSArray arrayWithObjects:@"AA", @"BB", @"CC", @"DD", nil]; } My NSTokenField can

ASIHTTPRequest, EXC_BAD_ACCESS when request did finished

二次信任 提交于 2019-12-19 09:52:58
问题 I'm trying to do an asynchronous request with ASIHTTPRequest, but have some problem getting notified when the request is done. -(void)doDownload{ NSURL *url = [NSURL URLWithString:@"http://www.someurl.com/?"]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:@"someValue" forKey:@"someField"]; [request setRequestMethod:@"POST"]; [request setDelegate:self]; [request setDidFinishSelector:@selector(requestFinished)]; [request startAsynchronous]; } -

Signals and slots implementation in Delphi?

纵饮孤独 提交于 2019-12-19 09:04:04
问题 Does an implementation of the signals and slots mechanism for event dispatching exist for Delphi? 回答1: Search for multicast events. There are a few implementations out there, e.g. http://www.deltics.co.nz/blog/?p=137 http://blogs.embarcadero.com/abauer/2008/09/03/38867 http://www.codebot.org/delphi/?doc=9568 Some of them need generics, so are D>2009 only. 回答2: Whilst you can implement multi-cast events yourself, they are not directly supported in the the language unlike in C# and VB.NET. Lack

NSURLConnectionDelegate connection:didReceiveData not working

限于喜欢 提交于 2019-12-19 07:39:34
问题 I need some help regarding the NSURLConnectionDelegate method. - (void)startDownload { NSString *URLString = [NSString stringWithFormat:appRecord.imageURLString]; NSURL *url = [NSURL URLWithString:URLString]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; imageConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if(imageConnection) { activeDownload = [NSMutableData data]; } } I am using this method to initiate the NSURLConnection, but the - (void

Why can't a function with byref be converted directly to delegate?

岁酱吖の 提交于 2019-12-19 07:23:47
问题 Under normal circumstances, F# functions can be converted to delegates by calling new DelegateType and passing in the function as an argument. But when the delegate contains byref parameter, this is not possible directly. For example the code: type ActionByRef<'a> = delegate of 'a byref -> unit let f (x:double byref) = x <- 6.0 let x = ref 42.0 let d = new ActionByRef<_>(f) won't compile, giving the following error: This function value is being used to construct a delegate type whose

handle when callback to a dealloced delegate?

冷暖自知 提交于 2019-12-19 04:18:11
问题 I implemented the delegate-callback pattern between two classes without retaining the delegate. But in some cases, the delegate is dealloced. (My case is that I have a ViewController is the delegate object, and when the user press back button to pop that ViewController out of the NavigationController stack) Then the callback method get BAD_EXE: if (self.delegate != nil && [self.delegate respondsToSelector:selector]) { [self.delegate performSelector:selector withObject:self withObject

Set UITabBarController created in Interface Builder as delegate

瘦欲@ 提交于 2019-12-19 02:30:14
问题 I created my iOS app with Tab Bar template, so here is UITabBarController with bar buttons. An issue is how to set it as delegate. I found at SO that it has to be set programmatically in AppDelegate, but I believe it's impossible, because I've got no access to Tab Bar Controller as outlet. I added proper value to @interface (both ViewController and AppDelegate), but doesn't know what to do next. @interface ViewController : UIViewController <UITabBarControllerDelegate> I hope I don't have to