您好,登錄后才能下訂單哦!
設置賬號,密碼字體的顏色 NSMutableDictionary *dict = [NSMutableDictionary dictionary]; dict[NSForegroundColorAttributeName] = [ICETools colorWithHexString:@"C1C0C2"]; NSAttributedString *attribute = [[NSAttributedString alloc] initWithString:self.accountTextFiled.placeholder attributes:dict]; [self.accountTextFiled setAttributedPlaceholder:attribute]; self.accountTextFiled.layer.cornerRadius = 2; self.accountTextFiled.layer.borderColor = [[ICETools colorWithHexString:@"fb3c60"]CGColor]; self.accountTextFiled.layer.borderWidth = 1.2; self.accountTextFiled.layer.masksToBounds = YES; // UILabel 根據內容顯示Label的一些設置 //給UILabel設置行間距和字間距 -(void)setLabelSpace:(UILabel)label withValue:(NSString)str withFont:(UIFont*)font { NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init]; paraStyle.lineBreakMode = NSLineBreakByCharWrapping; paraStyle.alignment = NSTextAlignmentLeft; paraStyle.lineSpacing = UILABEL_LINE_SPACE; //設置行間距 paraStyle.hyphenationFactor = 1.0; paraStyle.firstLineHeadIndent = 0.0; paraStyle.paragraphSpacingBefore = 0.0; paraStyle.headIndent = 0; paraStyle.tailIndent = 0; //設置字間距 NSKernAttributeName:@1.5f NSDictionary *dic = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paraStyle, NSKernAttributeName:@1.5f }; NSAttributedString *attributeStr = [[NSAttributedString alloc] initWithString:str attributes:dic]; label.attributedText = attributeStr; } //計算UILabel的高度(帶有行間距的情況) -(CGFloat)getSpaceLabelHeight:(NSString)str withFont:(UIFont)font withWidth:(CGFloat)width { NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init]; paraStyle.lineBreakMode = NSLineBreakByCharWrapping; paraStyle.alignment = NSTextAlignmentLeft; paraStyle.lineSpacing = UILABEL_LINE_SPACE; paraStyle.hyphenationFactor = 1.0; paraStyle.firstLineHeadIndent = 0.0; paraStyle.paragraphSpacingBefore = 0.0; paraStyle.headIndent = 0; paraStyle.tailIndent = 0; NSDictionary *dic = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paraStyle, NSKernAttributeName:@1.5f }; CGSize size = [str boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOriginattributes:dic context:nil].size; return size.height; } |
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。