how to do tooltip on button in iphone? - iphone

I am having download icon on my page i want that when the user takes his finger over the button a tooltip should show as showing download in text.
is there any option in iphone to show a tooltip???

Dan is absolutely right on how to do it but I'd answer you should rethink your design to not need the tooltip at all.
There's a reason that there isn't one by default - what if the user presses down on the button to see what it does, reads the tooltip and realises that's not what they want. They then have to be very careful not to let go while still over the button or it will press and do the wrong thing. (And most users don't know that they can press down over a button, move their finger off it and release it to cancel the press.)
You should rethink your design to make it obvious what the buttons do without the user having to interact with them first.
However, if you definitely still want a tooltip, Dan's method is fine.

Nothing built-in, no. If you think about it, generally a tooltip appears when you mouse over the target item. There's no "mousing over" with a touch interface.
You can definitely roll your own, though. Start by placing a view containing your tooltip contents exactly where you want it with an alpha of 0%. Make a custom button with no content that outlines your download icon, and hook its "touch down inside" action to a method that animates the tooltip view to an alpha of 100%. Hook your button's "touch up inside" , "touch down outside" and "touch up outside" actions (and maybe some others--you might want to experiment with that) to a method that animates the tooltip view back to an alpha of 0%.

There isn't native support for this in iOS. But you can create your own.
I ended up creating my custom tooltip/popover class.
Can be initalised with any content view and dynamically adjusts it's frame.
Hope it helps.
https://github.com/akeara/AKETooltip

Related

XCode 10 adding action to button

I'm trying to make a Cocoa app with buttons that run simple command line scripts.
I can't seem to figure out how to add the action to my button.
I've read some docs that suggest holding down option and dragging the button into controller code but I think they are out of date. Can someone suggest how to get there from this screenshot?
You need to first select your button, then hold the control ⌃ button on your keyboard and then drag that across to your view controller. That will then give you the option of what to name your method etc.
Actually I had the same problem and the root cause was just the drag method. From the descriptions I had assumed that I need to press CTL and then drag while having the left mouse button pressed. This did not work at all (in my environment). Then I noticed that "it works" with the right mouse button. But the result was not correct. (E.g. I could not get "Action"). Finally I found: I have to use the right mouse button only for dragging without holding CTL. Then I got the correct result.

NSButton in Swift, handle click and release events

i'm trying to manage different state of a simple push button on an OS X application : When the user click on it, and when the user release the click.
Currently i set my button type by NSMomentaryLightButton
NSMomentaryLightButton When the button is clicked (on state), it
appears illuminated. If the button has borders, it may also appear
recessed. When the button is released, it returns to its normal (off)
state.
This type of button is best for simply triggering actions because it
doesn’t show its state; it always displays its normal image or title.
This option is called Momentary Light in Interface Builder’s Button
inspector
I thought it was the good way, but when i print my button status, it's like a toggle button than the push button that i set. As you can see on exemple gif
To sum up, How can i have a real push button behaviour ? Call function when the user click on it, and when the user release the click.
Thank,
You don't want to use buttons for piano keys. First, they are non-rectangular, and they don't act as buttons do: neither single-action push-button, nor toggle switches. You are interacting in a custom way, with a custom view, meaning the NSButton control hierarchy isn't called for. Instead you're subclassing NSView and capturing low-level mouse events as detailed here:
https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/10000060i-CH6-SW1
You found this yourself as you detailed in your own comments, but I wanted to make sure you had a higher level point of view. It's even possible, and probably best, to consolidate all of the piano keys into a single view, and let the keys themselves be rendered using NSBezierPath and perform mouse hit detection using containsPoint:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBezierPath_Class/#//apple_ref/occ/instm/NSBezierPath/containsPoint:
This is a lot more work but the only way to make a truly professional looking piano simulation. Then you can render the keys with whatever outline, fill, and labeling you need without the limitations of built-in button shapes and layout. You could even have the bottom edges of the keys slightly rounded, for example, or apply a shiny texture.

How can i make a moving button in GWT, so that users can move it to anywhere they want?

I just want to make a moving button , Is there a way to do that in GWT? Thanks in advance.
BS
Out of the box, you can use a DialogBox to display your button. DialogBox can be moved around, but you will need to display something in a Caption that is used for dragging.
Another option is to use PopupPanel. It can be completely invisible (no Caption), but you will have to implement dragging functionality on your own. The advantage is that a PopupPanel floats on top of all the other layers in your UI.
Finally, you can simply add dragging functionality to a regular button. Just remember to check for the boundaries so that a user cannot drag your button outside of the visible browser area - or obscure some important elements of the UI.

iOS Objective-C UIButton action not working correctly

I am making a simple application for iphone (for learning and education purposes). Inside the .XIB file there is a button used to clear all text fields on the screen. I create a "clear:" method for the button. assign the method to "Touch Up Inside", but when I run the app in iOS Simulator the button acts like the "clear:" method has been assigned to "Touch Up Outside". I click the button nothing happens, I click and hold the button then drag my mouse pointer outside of the button and let go and all text fields clear. Can anyone help me make it so "Touch Up Inside" works properly? (If I am completely mistaken, and sound like a noob just tell me, I am a beginner)
Are you sure you have it hooked up correctly to TouchUpInside? Try deleting that Send Event association, and redoing it.
It should look something like this:

which UIButton event can act as a mouse over event like in flash

i would like to create a UIButton it will zoom in when mouse over it,can anyone tell me which event can do this
There is no mouse, only touches. How can you hover over a button without tapping it on a touch based interface? I dont think it works the way you think it does.
Hop into interface builder. Drop in a button and look in the attribute window.
You'll see the section that has Title: Image: Background. If you click on the drop down that says 'ALL', you can select several button states and set them accordingly. Use the highlighted state for when the user presses down on the button.
This should get you to understand how it works. You can dig into the docs to find out how to do it programaticaly from there.
Hover on the iPhone is a touch. Unless you're tracking where the finger is and you want objects to react when you enter their bounds. But the highlighted state should get you there.