saidaltintop
4/30/2019 - 11:44 AM

yazının altını çizme ve yazıya link ekleme

 let threeDaysFreeString : String = " weekly,\nafter 3-days free trial period"
						// self.oneWeekPrice.text = "You will be charged \(strCurrency)" + threeDaysFreeString;
                        
                        let string              = "You will be charged \(strCurrency)" + threeDaysFreeString;
                        let range               = (string as NSString).range(of: strCurrency)
                        let attributedString    = NSMutableAttributedString(string: string)
                        
                        //attributedString.addAttribute(NSAttributedStringKey.link, value: NSURL(string: "http://www.google.fr")!, range: range)
                        attributedString.addAttribute(NSAttributedStringKey.underlineStyle, value: NSNumber(value: 1), range: range)
                        attributedString.addAttribute(NSAttributedStringKey.underlineColor, value: UIColor.black, range: range)
                        
                        self.oneWeekPrice.attributedText = attributedString
                    
                        ***********************
NSString *priceString=[NSString stringWithFormat:@"Start your 3-day free trial\nYOU  WILL BE BILLED %@ WEEKLY",strPriceWeekly];
                
                NSRange range = [priceString rangeOfString:strPriceWeekly];

                NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:priceString];
                
                [attributeString addAttribute:NSUnderlineStyleAttributeName
                                        value:[NSNumber numberWithInt:1]
                                        range:range];
                
                UIFont *helvFont = [UIFont fontWithName:@"OpenSans-Bold" size:12.0];

                [attributeString addAttribute:NSFontAttributeName
                                   value:helvFont
                                   range:range];

                self.label_price.attributedText = attributeString;