zoukankan      html  css  js  c++  java
  • button添加链接的title显示效果代码

    -(void)setLinks

    {

        NSString *text = @"Privacy Policy.";

        NSMutableAttributedString * attributedText = [[NSMutableAttributedString alloc] initWithString: text];

        NSRange range = NSMakeRange(0, [attributedText length]);

        [attributedText beginEditing];

        // next make the text appear with an underline

        NSRange underLineRange = range;

        range.length -= 1;

        [attributedText addAttribute: NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSSingleUnderlineStyle] range:underLineRange];

        [attributedText addAttribute:NSFontAttributeName value:PRDefaultFontWithSize(NO, 12) range:range];

        [attributedText addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithDeviceRed:237/255.0 green:187/255.0 blue:112/255.0 alpha:1] range:underLineRange];

        [attributedText addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithDeviceRed:128/255.0 green:128/255.0 blue:128/255.0 alpha:1]range:NSMakeRange([attributedText length]-1, 1)];

        [attributedText endEditing];

        [self.linkBtn setAttributedTitle:attributedText];

        [attributedText addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithDeviceRed:128/255.0 green:128/255.0 blue:128/255.0 alpha:1] range:range];

        [self.linkBtn setAttributedAlternateTitle:attributedText];

        [self.linkBtn setToolTip:@"http://www.cisdem.com/about/privacy-policy.html"];

    }

    -(IBAction)privacyPolicyLinks:(id)sender

    {

         [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.cisdem.com/about/privacy-policy.html"]];

    }

  • 相关阅读:
    ZOJ1450 BZOJ1136 BZOJ1137 HDU3932[最小圆覆盖]
    POJ 1755 Triathlon [半平面交 线性规划]
    POJ 3384 Feng Shui [半平面交]
    POJ 3525 Most Distant Point from the Sea [半平面交 二分]
    POJ 1279 Art Gallery [半平面交]
    POJ3335 POJ3130 POJ1474 [半平面交]
    POJ 3608 Bridge Across Islands [旋转卡壳]
    nginx访问量统计
    PV UV QPS 并发数
    PV、UV、IP之间的区别与联系
  • 原文地址:https://www.cnblogs.com/PJXWang/p/5816655.html
Copyright © 2011-2022 走看看