delegates

Getting iPhone app to display one of two different views

喜欢而已 提交于 2019-12-25 01:50:00
问题 I have a program where we are using a navigation controller and need the app to launch to one of two different views. Basically if certain info has previously been entered then we need the app to launch to view A, but if the info has never been entered then we need it to launch to view B. I am having difficulty getting this to work and am wondering what ways if any I could implement this. I am certain it needs to be done in the app delegate but I am not sure how. Thanks in advance! 回答1:

Using a protocol and a delegate

折月煮酒 提交于 2019-12-25 01:49:06
问题 I am trying to get some code in a view working. I have declared a delegate and it does not get instantiated, any Idea what I am missing? I have tried to summarise how I have done this below. I think that the issue is that somewhere, my dataSource delegate needs to be instantiated. I have a View called graph view and a delegate that is in the viewcontroller GraphViewController. I know that the method in GraphView is doing something as it calls the AxisDrawing helper class and draws in Axes.

Custom delegate not working

梦想与她 提交于 2019-12-25 01:11:41
问题 I have started working more with delegate as suggested in another question I made. Now, I have made a UIViewController called ProfileViewController in which I would like to load the News Feed from Facebook. I also have subclass of NSObject called FBFeed . This subclass loads the Facebook News Feed and should pass it back to the view controller. All my requests to Facebook are sent through a singleton named FBRequestWrapper which (in this case) should pass the result to FBFeed . I call

cocos2D deallocing CCScheduler

£可爱£侵袭症+ 提交于 2019-12-25 00:18:43
问题 This problem started happening when I subclassed CCSprite (Entity) to recieve touch input. When I'm going away from the main scene by pushing to another, I make all Entities remove their delegation from the shared CCTouchDispatcher (ie onExit()). And then reactivate when the main scene returns (onEnterTransistionFinished()). Half of the times this works fine. However, the other times this happens: cocos2d: deallocing <CCScheduler: 0x2323a0> Which I find rather strange. Is it even plausible

jQuery event delegation for select/options in Chrome

為{幸葍}努か 提交于 2019-12-24 20:57:54
问题 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 the best alternate solution? btw, jQuery Click on Event.. gives a potential solution using .change(), but I would like to manage all bindings with .delegate() if possible.

Making Thread-Safe Calls to labels in Windows Forms Controls

大城市里の小女人 提交于 2019-12-24 20:15:36
问题 I am making a small app in Visual C++ in Microsoft Visual Studio where I am collecting data in a thread and displaying the information in labels in a Windows Form. I am trying to follow this Article/Tutorial on how to make the calls to the labels thread safe: http://msdn.microsoft.com/en-us/library/ms171728(VS.90).aspx. The example shows how to output text to one text box, but I want to output to many labels. When I try I get the error: error C3352: 'void APP::Form1::SetText(System::String ^

execute functions after a dynamically created div's content(like images) is loaded, using jQuery

余生长醉 提交于 2019-12-24 20:11:53
问题 i want to execute some functions only after a dynamically created DIV's content (which will includes text and images) is loaded completely. Here the dynamically created DIV is "#element"+data. The below is not working. $("#section"+currSect).delegate( "#element"+data, "load", function() { remvPanel(); showFormBox(); } ); This also not working. $("#element"+data).load(function() {remvPanel(); showFormBox();}); Please Help! :( 回答1: Will this do it? jQuery .load() This method is a shortcut for

why does (sender,e) => SomeAction() works on winforms and not in asp.net

假如想象 提交于 2019-12-24 19:01:43
问题 I have the following code: btnTest.Click += (sender,e) => SomeAction() why does this code works in WinForms and not in asp.net. In asp.net I had to do the following: btnTest.Click += new EventHandler(SomeAction); target framework in both cases is .net 4.0 回答1: Is it possible you are trying to call btnTest.Click += (sender,e) => SomeAction() from inside the Page_Load method or another event handler? In that case the parameters "sender" and "e" are already declared and can be causing a conflict

Calling method in another view controller from modal view controller using a delegate

末鹿安然 提交于 2019-12-24 18:49:21
问题 I am using a modal segue to create a view controller that I want to dismiss and then call a method in the origin view controller. I have used a protocol/delegate pattern but for some reason the method is never called. The code is below: Please note that I removed a lot of non-relevant code to keep it clean here Thanks!! VC1: final class WorkoutViewController: UIViewController, StartWorkoutButtonDelegate { weak var dataSource: WorkoutViewControllerDataSource! private var workout: Workout!

NSXMLParser delegates Handling Attributes

*爱你&永不变心* 提交于 2019-12-24 17:44:11
问题 I am currently trying to get my parser delegates to work with a custom NSObject I have created for the attributes of the xml I am receiving.. This is the XML that is being read in to my parser delegates <Rows> <Row SKATERID="706" MANUFACTURER="GAZ" ISFACT="F" ISSKATE="F"/> <Row SKATERID="318" MANUFACTURER="MAN" ISFACT="F" ISSKATE="T"/> //... </Rows> This is what I have for my -parser:didStartElement:namespaceURI:qualifiedName:attributes: method: - (void)parser:(NSXMLParser *)parser