ios - UIbutton which displays a popover label briefly where the label would show halfway outside the button -


How do I create a UIButton, which will briefly summarize a UBIL like some speech bubble that will appear disappear. The problem is that speech bubbles will be a scene that comes halfway outside the button frame.

Add a UIButton to the .xib file and give a few names.

Add a Falling Method to Your Code - (IBAction) bubbleButn: (UIButton *) BTN

Then right-click on the button and click the "Touch up" Inside "section. See the part. After that you can click and drag the most circles for the owner of the files in the "Placeholder" section of Xocde, then you can see that the method name comes in a menu. You can choose our method from there.

Next we are going to introduce our code

First of all, you must declare the UILB in the .h file.

  #import & lt; UIKit / UIKit.h & gt; @ Interface view controller: UIViewController {UILabel * bubbleLabel_; } @end   

And then. Apply button action and label settings to M file.

  - (IBAction) bubbleButn: (UIButton *) BTN {float off = BTN.frame size.width / 2; Float yVal = BTN.frame.edame.height / 2; If (Bubble Label_) {/ * If you are not using the 'Arc' of this statement, then also add it to the Delok method * / [BabelLabal_ release]; Bubble lal_ = zero; } Bubble Label_ = [[UILabel alloc] initWithFrame: CGRactMake (BTn.fr.origin.x + Half, BTN.frame.gi.a + Yewell, 40, 50)]; BubbleLabel_.text = @ "Hi"; [Self.view addSubview: bubbleLabel_]; [Self display selector: @ searcher (hide bubble) withObject: day after self: 3]; } - (zero) hide bubble {[bubbleLabel_ removeFromSuperview]; }   

A label with the name "Hi" will be for 3 seconds.

Let's go ...

Comments