Tips in iOS through native user interface controls?

How to create tooltips or something similar in iOS without using any third-party classes? I have a UIButton that I would like to pop up tooltips for a few seconds or until it is cleared. I have seen third-party classes and libraries, but I want to know if it supports it. I also want to show the arrow that appears, where the tooltip comes from. I saw some UIActionSheet popups have this arrow.

Cheers, Amit

+4
source share
4 answers

Well, I ended up using the third tip of CMTopTipView afterall. This is a relatively low overhead, just a headline and implementation. Changed it a bit to account for ARC. Here is what I did:

#import "CMPopTipView.h" CMPopTipView *navBarLeftButtonPopTipView; - (void) dismissToolTip { [navBarLeftButtonPopTipView dismissAnimated:YES]; } - (void) showDoubleTap { navBarLeftButtonPopTipView = [[CMPopTipView alloc] initWithMessage:@"DOUBLE Tap \n to view details"] ; navBarLeftButtonPopTipView.delegate = self; navBarLeftButtonPopTipView.backgroundColor = [UIColor darkGrayColor]; navBarLeftButtonPopTipView.textColor = [UIColor lightTextColor]; navBarLeftButtonPopTipView.opaque = FALSE; [navBarLeftButtonPopTipView presentPointingAtView:catButton1 inView:self.view animated:YES]; navBarLeftButtonPopTipView.alpha = 0.75f; NSTimer *timerShowToolTip = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(dismissToolTip) userInfo:nil repeats:NO]; } 
+6
source

If you are using an iPad, you can use UIPopoverView . You also have a UIMenuController for working with similar features on your iPhone or iPad: a tutorial . Alternatively, you could make your own subclass of UIView to do this, but then you have to handle the arrow yourself.

+3
source

Well, what I did was relatively simple. I ended up using UIActionSheet without buttons, just text. Then used showFromRect from the coordinate plane, where the UIButton was in self.view.

 UIActionSheet *popup = [[UIActionSheet alloc] initWithTitle:@"DOUBLE Tap \n to view details." delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles: nil]; [popup sizeToFit]; popup.tag = 9999; CGRect myImageRect = CGRectMake(240.0f, 605.0f, 30.0f, -40.0f); [popup showFromRect:myImageRect inView:self.view animated:YES]; 

I can just suck it and use CMPopTipView (third-party control) to adjust its size, opacity and fading alpha.

+1
source

I saw some of you use CMPopTip, a great "library". Cool way!

Just a few things, if you use it in iOS7, you have some disadvantages.

New use of obsolete text (this is an example)

  NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; paragraphStyle.alignment = self.titleAlignment; [self.title drawInRect:titleFrame withAttributes:@{NSFontAttributeName:self.titleFont,NSParagraphStyleAttributeName:paragraphStyle}]; 

Bye!

+1
source

All Articles