Is there is an event fired when a button's title text changed?
I tried ValueChanged or EditingChanged events, but none of them are fired.
I don't think that there is an event that will capture this. I think your best bet is to subclass UIButton and override the Title method.
Related
I have the follwing declaration:
<Button Tapped="Handler1" DoubleTapped="Handler2" />
Each time I double tap the button the Handler1 gets fired. Handler 2 never gets fired.
Thanks.
You can't do in this way because it will always fire the first event of tap. You can manage the double tap with the single tap event using a boolean or a counter to manage the following tap events.
I do not know why the DoubleTapped handler does not get called. It should. Maybe IsDoubleTapEnabled is set to false? This could not just happen by explicitly setting the property in XAML, but also e.g. by inheriting the value from a style.
But even when DoubleTapped works, the Tapped event will always fire once. The control is no fortune teller: When the first tap happens, it does not know that a second tap will soon follow, so it fires the Tapped event. If you do not want this, you need to implement your own behaviour and either ignore or delay Tapped events.
MSDN:
If a user interaction also fires DoubleTapped, Tapped will fire first to represent the first tap, but the second tap won't fire an additional Tapped. If you want different logic for Tapped versus DoubleTapped, your Tapped handler may need to use app-specific variables and a timer in order to avoid running on interactions that are eventually interpreted as a DoubleTap action.
But using double taps is generally discouraged by the UX guidelines. I would not use them with buttons, because buttons usually do not work that way and you are breaking user expectations.
I have a scrollview where I added several buttons (dynamically, programmatically). Hence my view is totally covered with buttons. Also there are some labels
However, I observed that the uiscrollview is not scrolling when the drag starts on the button. All labels work fine. But I want this scroll to happen i.e. when drag event occurs in the uibutton, I want it to send this event to its superview (scrollview).
Please note, according to my search, subclassing the scrollview and overrriding the content touches event, or add touch began actions to uibuttons are not helpful.
How do one in general work with this event passing things when objects are added dynamically?
You have to subclass the UIScrollView, there's no other proper way, but you do not need to mess with the touch events. All you have to do is override this method
- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
return YES;
}
And set the canCancelContentTouches property of the UIScrollView to YES.
I'd like to know if there's a method that get's called before a tooltip is displayed. I can't find it anywhere.
No!!!
However you can create your own subclass of NSView with -mouseEntered() events.
There is no Done button on a Number Pad-type keyboard. I don't want to add a custom Done button, but how do I dismiss the keyboard?
You could add a UINavigationBar/UIToolBar with a done button(a UIBarButtonItem), and make the textField/textView resignFirstResponder on the done button's action.
You can add the UINavigationBar/UIToolBar as inputAccessoryView of textField/textView.
textField.inputAccessoryView = aNavBarWithDoneButton;
Edit: Availability iOS (3.2 and later)
The simplest solution is to add a new button somewhere in your UI that calls resignFirstResponder on your UITextField (or whatever) when tapped. Putting this in a toolbar is problematic on iPhone because toolbars are typically at the bottom of the screen and obscured by the keyboard.
A slightly more complex solution is to put an invisible UIView behind all of your other tappable UI elements. Any taps not handled by your existing UI will go to this new view, which can call resignFirstResponder on your text field.
If neither of these sound appealing, perhaps you should expand your question to include the type of behavior you want.
i want to fire a timer as user slides the slider when the touch ends.
is there a way to handle touch events of uislider?
Make sure your slider's continuous property is set to YES; then use -addTarget:action:forControlEvents: with... UIControlEventValueChanged?... in the usual way. The slider should continuously call whatever action method you give it.
I set the continuous property to NO and kept UIControlEventValueChanged and it manages to only fire off the event when the user releases the slider