delegates

Multi threading loop freezes ui

怎甘沉沦 提交于 2020-01-05 15:40:52
问题 I'm having trouble with mutli threading programming in my application. Actually, the code looks something like this: Private Delegate Sub IniciarDiscagemDelegate() Private Sub CallBack() 'do some stuff.... ThreadDiscagem = New Threading.Thread(AddressOf IniciarDiscagem) ThreadDiscagem.IsBackground = True ThreadDiscagem.Start() End Sub Private Sub IniciarDiscagem() If Me.InvokeRequired() Then Me.BeginInvoke(New IniciarDiscagemDelegate(AddressOf IniciarDiscagem)) Exit Sub End If Do While True

Multi threading loop freezes ui

徘徊边缘 提交于 2020-01-05 15:37:10
问题 I'm having trouble with mutli threading programming in my application. Actually, the code looks something like this: Private Delegate Sub IniciarDiscagemDelegate() Private Sub CallBack() 'do some stuff.... ThreadDiscagem = New Threading.Thread(AddressOf IniciarDiscagem) ThreadDiscagem.IsBackground = True ThreadDiscagem.Start() End Sub Private Sub IniciarDiscagem() If Me.InvokeRequired() Then Me.BeginInvoke(New IniciarDiscagemDelegate(AddressOf IniciarDiscagem)) Exit Sub End If Do While True

Passing some data back to RootViewController iOS 7

≡放荡痞女 提交于 2020-01-05 09:00:15
问题 Suppose , We have 3 ViewControllers called ViewControllerA , ViewControllerB , ViewControllerC in our UINavigationController . To be specific , ViewControllerA is the RootViewController and ViewControllerB and ViewControllerC are pushed on it. So, Currently ViewControllerC is on the Top and visible to user. I want to return to ViewControllerA by calling [self.navigationController popToRootViewControllerAnimated:YES]; method and pass some data to ViewControllerA from here. I have to update

Reflection and private delegate fields of events in c#

梦想的初衷 提交于 2020-01-05 08:58:16
问题 I'm probably doing something silly, but here it goes. I'm trying to get the FieldInfo from a public event via reflection. Check this function: public void PlotAllFields(Type type) { BindingFlags all = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; FieldInfo[] fields = type.GetFields(all); Console.WriteLine(type + "-------------------------"); foreach (var fieldInfo in fields) { Console.WriteLine(fieldInfo.Name); } } public class Bar : Foo {} public class Foo { public

Synchronizing UI, MKMapView and CLLocationManager delegates

故事扮演 提交于 2020-01-05 08:42:39
问题 I have a ViewController that is set as delegate of MKMapView and CLLocationManager . This ViewController also receives actions from UI buttons. I have a state machine that needs to be updated whenever some UI action happens or when a new location is available (whether it comes from MKMapView or CLLocationManager ) Obviously, the state machine update must be atomic, but I can't seem to find a good mechanism to do so. Here's a snippet of the code: m_locationSerialQueue = dispatch_queue_create(

UITabBar can't change selected index

独自空忆成欢 提交于 2020-01-05 07:22:08
问题 I'm having trouble changing the index of my UITabBar. I am attempting to change it from the UITabBarController subclass. This is what I'm trying: [self.tabBarController setSelectedIndex:1]; This is what my .h looks like #import <UIKit/UIKit.h> @interface CustomTab : UITabBarController <UITabBarControllerDelegate>{ IBOutlet CustomTab *bar; } @end I am trying to set the index with an IBAction, the method is being called, but the index doesn't change. Any ideas? 回答1: Because you are calling

Crash on Setting Delegate

前提是你 提交于 2020-01-05 05:47:07
问题 I have a custom view (settingview) with nib and protocol. i want to add this view on a viewcontoller with delegate. When i set its delegate my app crashes and i don't know what i have done wrong. i don't have NIB for ViewController. i am attaching few images of my code and View's NIB. .h @protocol SettingViewDelegate @required -(void)CornerSlider:(id)sender; -(void)MarginSlider:(id)sender; -(void)BorderSlider:(id)sender; -(void)ShadowSlider:(id)sender; -(void)BorderColor:(id)sender; -(void

Is there a difference between only <NSXMLParserDelegate>, only setDelegate method, or the use of both of them?

南楼画角 提交于 2020-01-05 05:42:08
问题 I noticed that when I do this : [myParser setDelegate:self]; it works :D (even if I didn't add the code in the header file ... you know, the <delegateStuff, delegateOtherStuff> in the interface declaration) When are you supposed to modify the header file to make your delegate work ? Is the setDelegate method enough to make it work ? Cheers for any help ;) Gauthier 回答1: In short, the <NSXMLParserDelegate> in your interface declaration is not required, it's there for error checking at compile

AudioServicesPlaySystemSound know when sound stopped

末鹿安然 提交于 2020-01-05 05:38:14
问题 Im using AudioServicesPlaySystemSound(soundID); to play a sound, but I need to know when the sound has stopped playing, so what is the delegate for this? Thanks! 回答1: Have you read the documentation? AudioServicesPlaySystemSound Plays a system sound object. void AudioServicesPlaySystemSound ( SystemSoundID inSystemSoundID ); Discussion This function plays a short sound (30 seconds or less in duration). Because sound might play for several seconds, this function is executed asynchronously. To

Delegate method not being called

本小妞迷上赌 提交于 2020-01-05 05:08:27
问题 I am making an OpenSource (github) helper class for downloading images asynchronously (I had major trouble with). However, I have delegate methods set up to alert the delegate that a image has finished downloading. The problem is that the delegate method is not getting called. I am setting the delegate and everything, but I don't have a clue why the problem is occurring. Please take a look at my code! I have only posted the relevant code. MKAsyncImageDownloader.h @protocol