Button suddenly responds to touch up outside, not touch up inside - objective-c

My iPhone application has just suddenly changed behavior and I have no idea why. I have a small button and it is now only firing on touch up outside and not touch up inside. I'm not aware of anything I changed that may have caused this.
As you can see from the image below, it is correctly wired for touch up inside to the onAdd selector.
Any ideas on what could cause this behavior?

Check GestureRecognizers, other IBActions in this view. Try to link up event with touchUpOutside and check is it working ok, then revert to Inside and check behaviour. Use NSLog in methods to see what's firing on tap. Without sample code I can't say much more.

Related

Animation not working when it comes from a notification

Working in an app with Objective-C I got the next problem:
I have a code that executes an animation in a UIViewController that is called with input from the user and also when a push notification comes from other user using this app.
The matter is that the first time i enter this UIViewController it works fine, but when unwind-segue and segue again to this UIViewController the animation that is executed with the notification code stops working. The code is being executed but the animation isn't showing. The segues are working modally.
If you need to see some code please tell me.
Thanks T_77 i found the solution to this problem.
It seems like i have some timers that wasn't being invalidated. Invalidating them at ViewWillDessapear did the fix.

xCode archived application isn't starting threads

My application consists of 2 windows.
The first window is the main window. It has an NSTextView and an NSView.
The second window is the preferences page. It has an NSColorWell which would change the background color of the NSView on the main window via a shared instance of a class that I called MainDATA.
When I press the build/run button in xCode, the app works perfectly. Everything functions as is should.
When I archive and export my app, everything works excepts except for the background color change. When I open the app, the background is initially set as it should be, but when I change the color with the ColorWell, the background doesn't update.
The background updates its color using a thread that would call [self setNeedsDisplay:YES] in another method by using performSelectorOnMainThread.
I have no idea how to troubleshoot this because like I said, everything works perfectly when testing the app.
Any ideas?
Update: Just found out that the reason it isn't updating is because threads aren't starting. Still not sure why.
Ahhh!
That was frustrating...
I just found out that while(true){}loops DON'T work in archived applications. If anyone wants to explain to me why it is like that, let me know.
I hope this answer helps some people avoid the confusion and frustration I just went through:)

Button does not react

I have a strange behaviour with an NSButton. It works normal until I do so voodoo somewhere else in my app. Right then the button does no longer react on click events. It still looks normal (so not disabled). It just does not do anything when I click it. Any idea where I should look in the properties of NSButton that might have been changed accidentally? (Quite sure I did not touch the button itself.)
Ensure your button is in a 'touchable' zone in its superView. I mean It have ro be placed inside it superView bounds (If not, you can see It, depending on Clipping properties, and you can't interact with It). In order to check it, set a color to your container view.
Also check userInteraction is enabled...
Hope It helps.
If your button is just not giving the animation, it might be an Xcode bug. I had a similar problem before, and I filed a bug, and it got fixed on the next Xcode version. Check out my SO question. Toolbar bar button item not working properly in SplitViewController
If you really need to give it an animation, you could probably do it in code with something like this. Please note that this is untested so it may not work, or you might need some fixing, but you get the idea :)
- (IBAction)buttonAction:(id)sender {
self.button.titleLabel.textColor = [UIColor lightGrayColor];
// Action
self.button.titleLabel.textColor = [UIColor darkTextColor];
// Or with delay
[self performSelector:#selector(changeButtonColor) withObject:nil afterDelay:0.1];
}
I figured it out. The button opened a transient popover. In order to close this popover due to an action I had coded
view.window!.orderOut(self)
After replacing it by
view.window!.performClose(self)
the strange effect was gone. I'm not sure, but this looks like a bug in the Swift runtime. I'll report it and see what comes out.

Objective-C - Detect dismiss of a view after page curl

I have a Main View which call a settings panel in another view with the page curl transition. All seems fine, but when I close the settings view it doesn't trigger the "viewWillAppear" method of my Main View causing me a lot of troubles because it doesn't get updated with the settings.
There is an answer which seems fine for me, but I don't know how to implement it. There is another easy way or someone who can explain to me how to apply that answer?
Thanks in advance.
Instead of reacting to views, you should probably react to settings changes. What I mean by that is that it would be a more solid design to use Key-Value Observing (KVO) so that your main view can be notified of changes to the objects that represent your settings.
Alternatively, if you can't or don't want to observe a specific object, you can use NSNotificationCenter and have your settings view fire a notification when the new settings are applied and your other view can register to listen to those notifications.
Here is a simple example of that.
I hope this helps solve your problem.

UIPopOver is disappearing unnecessarily

I have implemented UIPopOver in my class to display certain options, in simulator it is working properly but in device it is disappearing even if I do not click on any other area.Can anyone know why popover is behaving weirdly in device?And how I can overcome this?
Thanks in advance!
Please provide the code you use to display your controller. A wild guess would be that your controller is not retained correctly and may be released or its parent controller is being released.
You should also check that you simulator is running the same ios version as your device.
Can't help more without more details.