Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifying font in Swift #280

Open
idokleinman opened this issue Jun 30, 2016 · 1 comment
Open

modifying font in Swift #280

idokleinman opened this issue Jun 30, 2016 · 1 comment

Comments

@idokleinman
Copy link

idokleinman commented Jun 30, 2016

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?

@gotkaren
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants