TSMessages icon indicating copy to clipboard operation
TSMessages copied to clipboard

modifying font in Swift

Open idokleinman opened this issue 9 years ago • 1 comments

this does not translate to Swift:

#import <TSMessages/TSMessageView.h>
@implementation TSAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //If you want you can overidde some properties using UIAppearance
    [[TSMessageView appearance] setTitleFont:[UIFont boldSystemFontOfSize:6]];
    [[TSMessageView appearance] setContentFont:[UIFont boldSystemFontOfSize:10]];
     return YES;
}

couldn't set notification font in Swift. Any advice?

idokleinman avatar Jun 30 '16 00:06 idokleinman

Hi @idokleinman . I also wanted to translate the implementation to Swift.

I took a look to the Objective-c code and I found out this:

 NSString *fontName = [current valueForKey:@"titleFontName"];
        if (fontName != nil) {
            [self.titleLabel setFont:[UIFont fontWithName:fontName size:fontSize]];
        } else {
            [self.titleLabel setFont:[UIFont boldSystemFontOfSize:fontSize]];
        }

So I just added the parameter titleFontName to the TSMessagesDefaultDesign file and it worked for me. The name for the Subtitle text font is contentFontName

screen shot 2016-08-17 at 11 59 07 am

It works just like the other parameters do.

gotkaren avatar Aug 17 '16 18:08 gotkaren