delegates

Delegate method won't fire (is null). Using ARC

放肆的年华 提交于 2019-12-23 04:27:04
问题 I'm having trouble getting my delegate method to fire. I have the following code: @class Location; @protocol LocationDelegate - (void)location:(Location*)location foundLocation:(CLLocation*)location; - (void)location:(Location*)location failedToLocateUserWithError:(NSError*)error; @end @interface Location : NSObject { __unsafe_unretained id <LocationDelegate> delegate; } @property (nonatomic, assign) id <LocationDelegate> delegate; @end ... @implementation Location @synthesize delegate; -

WebUIDelegate methods not called

醉酒当歌 提交于 2019-12-23 04:18:27
问题 For some reason the following webview UI delegate methods are never called. Tried opening, clicking, interacting with webview to trigger the delegate calls and nothing works. - (void)webViewFocus:(WebView *)sender { NSLog(@"focusing %@", sender); } - (void)webViewUnfocus:(WebView *)sender { NSLog(@"unfocusing %@", sender); } - (BOOL)webViewIsStatusBarVisible:(WebView *)sender { return YES; } - (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible { NSLog(@"%@ %d", sender, visible)

Custom delegate for NSWindow

浪尽此生 提交于 2019-12-23 03:10:06
问题 I want to create a custom delegate for NSWindow . CustomWindow is subclassed to get notified about NSWindowDelegate events. Now I want to create delegate for this CustomWindow . I tried following code: CustomWindow.h @class CustomWindow; @protocol CustomWindowDelegate - (void)method1:(CustomWindow *)sender userInfo:(NSMutableDictionary*) userInfo; - (void)method2:(CustomWindow *)sender event:(NSEvent *)theEvent; - (void)method3:(CustomWindow *)sender; @end @interface CustomWindow : NSWindow

Generate a C# delegate method stub

醉酒当歌 提交于 2019-12-23 02:51:12
问题 Anyone know how to automatically create a delegate stub method? In WPF it seems im constantly having to pass delegates around. i would like to be able to type a method name that doesnt exist and have a method stub automatically generated...currently i'am having to constantly reference the docs to get the delegate signature and then manually create method with matching signature. 回答1: Use an IDE plugin like Refactor Pro! It also allows you to convert your delegates to instance methods, or if

Implementing a delegate to enable a modal view to pass data back to a UIViewController

拥有回忆 提交于 2019-12-23 01:42:03
问题 I am trying to implement a delegate to enable a modal view to pass data back to a UIViewController. I have two view controllers, my main UIViewController and the modal. Using the code below, the [delegate translationTextEntered:@"Test"]; doesn't affect the main screen (i.e. 'translationTextEntered' never gets called) My Main Controller This contains a method to be called when the modal has the user's value: MainViewController.h - (void)translationTextEntered:(NSString *)txt;

Clicking on Like all the view should show like objective C

こ雲淡風輕ζ 提交于 2019-12-23 01:11:52
问题 When I select Throwback -> Description occurs if I click on like button the like button changes to unlike and " like count=1099" increases. If I press back I want this unlike to be displayed next to Throwback let say in a label and again select Throwback button should display unlike and like Count should be 1100. please Help how can i achieve this ? //DetailOfUser.m #impot"DetailsOfStories.h" @interface DetailOfUser ()<UITableViewDelegate,UITableViewDataSource> { NSMutableArray

Unsubscribing from anonymous delegate event

限于喜欢 提交于 2019-12-22 20:04:09
问题 I'm having some trouble with figuring out a way of unsubscribing from some anonymous delegate events that i found in a pre-made helper file that helps allow movement of controls at run time. The reason i want to unsubscribe to these events is so that the control (in this case buttons) will become locked again and not able to be moved. Here is the method in the helper class: public static void Init(Control control) { Init(control, Direction.Any); } public static void Init(Control control,

C++ delegate creation

橙三吉。 提交于 2019-12-22 17:43:12
问题 I was wondering if theres a way to mimic this delegate behaviour (from C#) in C++ new ModifyTargetingStatus("Reversal", "Reverses physical attacks back at the user", -1, new List<CALL_CONDITION>(){CALL_CONDITION.Targetted}, attemptChange: delegate(CharacterMove move, BattleCharacter[] users, ref BattleCharacter[] targets, BattleCharacter holder, BattleField field) { if (targets != null && targets.Length == 1 && targets[0] == holder && (move.MoveClass == MOVE_CLASS.MC_BASIC_ATTACK || move

Binding a method for Block in Xamarin

人走茶凉 提交于 2019-12-22 17:06:54
问题 I am trying to add a binding for this in Xamarin iOS. How can I convert that in Xamarin ? (void)orderingTiles { [self traverseTilesWithBlock:^(UIImageView *tileImageView, int i, int j) { [self bringSubviewToFront:tileImageView]; }]; } (void)traverseTilesWithBlock:(void (^)(UIImageView *tileImageView, int i, int j))block { for (int j = 1; j <= self.board.size; j++) { for (int i = 1; i <= self.board.size; i++) { NSNumber *value = [self.board tileAtCoordinate:CGPointMake(i, j)]; if ([value

How to call delegate from string in C#?

谁说胖子不能爱 提交于 2019-12-22 16:54:25
问题 is it possible to call a delegate stored in a variable by its variable name (as a string)? i guess i'd have to use reflection mechanism, but i'm not getting anywhere example code: class Demo { public delegate int DemoDelegate(); private static int One() { return 1; } private static void CallDelegate(string name) { // somehow get the value of the variable with the name // stored in "name" and call the delegate using reflection } private static void CallDelegate(string name, DemoDelegate d) { d