How to set color of templated image in NSTextAttachment

It seems that there’s a bug in UIKit. There’s a workaround for that ;] For some reason you need to append empty space before image attachment to make it work properly with UIImageRenderingModeAlwaysTemplate. So your snippet would look like that (mine is in ObjC): – (NSAttributedString *)attributedStringWithValue:(NSString *)string image:(UIImage *)image { NSTextAttachment *attachment = [[NSTextAttachment … Read more

Center NSTextAttachment image next to single line UILabel

You can use the capHeight of the font. Objective-C NSTextAttachment *icon = [[NSTextAttachment alloc] init]; UIImage *iconImage = [UIImage imageNamed:@”icon.png”]; [icon setBounds:CGRectMake(0, roundf(titleFont.capHeight – iconImage.size.height)/2.f, iconImage.size.width, iconImage.size.height)]; [icon setImage:iconImage]; NSAttributedString *iconString = [NSAttributedString attributedStringWithAttachment:icon]; [titleText appendAttributedString:iconString]; Swift let iconImage = UIImage(named: “icon.png”)! var icon = NSTextAttachment() icon.bounds = CGRect(x: 0, y: (titleFont.capHeight – iconImage.size.height).rounded() / … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)