Tuesday, 8 April 2014

UIButton Or UILabel with underlined text. iOS 6 or iOS 7


//Button

NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:@"ADD ANOTHER CONTACT"];

[commentString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [commentString length])];

// Or for adding Colored text use----------
    UIColor* textColor = [UIColor blueColor];


    [commentString setAttributes:@{NSForegroundColorAttributeName:textColor,NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]} range:NSMakeRange(0,[commentString length])];


// Or for adding Colored text use----------


    [_addContactButton setAttributedTitle:commentString forState:UIControlStateNormal];




//Label

 NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:@"ADD ANOTHER CONTACT"];
    
  UIColor* textColor = [UIColor blueColor];
    
[commentString setAttributes:@{NSForegroundColorAttributeName:textColor,NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]} range:NSMakeRange(0,[commentString length])];
    
 [self.label setAttributedText:commentString];







7 comments:

  1. Whether you're implementing UIButton or UILabel with underlined text in iOS 6 or iOS 7, attention to detail matters. Just like precision in coding, prioritize your oral health. Explore Delhi Dentists for a seamless blend of technical finesse and a healthy smile. It's all about balance.

    ReplyDelete
  2. Enhance your gaming experience with our premier Rust game server. Secure, reliable, and customizable solutions tailored to your needs.

    ReplyDelete
  3. In iOS 6 or iOS 7, implementing underlined text in UIButton or UILabel adds versatility to user interfaces. Whether you're guiding users with buttons or displaying important information with labels, underlined text enhances readability and engagement. Just as a well-designed dinosaur statue captures attention, this subtle detail can elevate the overall aesthetic and functionality of your app.

    ReplyDelete
  4. Optimize your website with expert CPanel Server Management solutions. Ensure smooth performance and security with our services.

    ReplyDelete
  5. Step into a world of suspense and excitement with GeoFlixzPlus, the ultimate streaming destination for thriller movies. Whether you love edge-of-your-seat psychological dramas, intense crime stories, or heart-racing mysteries, our extensive library has something for every thrill-seeker.

    ReplyDelete