mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
ee62cbdf23
Support for drafts. Unsent messages are saved in case you want to send them later on and were interrupted while redacting them.
38 lines
1.4 KiB
Objective-C
38 lines
1.4 KiB
Objective-C
//
|
|
// UIFont+OWS.m
|
|
// Signal
|
|
//
|
|
// Created by Christine Corbett Moran on 2/10/15.
|
|
// Copyright (c) 2013 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "UIButton+OWS.h"
|
|
#import "UIFont+OWS.h"
|
|
#import "UIColor+OWS.h"
|
|
@implementation UIButton (OWS)
|
|
|
|
+ (UIButton *)ows_blueButtonWithTitle:(NSString *)title
|
|
{
|
|
NSDictionary *buttonTextAttributes = @{
|
|
NSFontAttributeName : [UIFont ows_regularFontWithSize:15.0f],
|
|
NSForegroundColorAttributeName : [UIColor ows_materialBlueColor]
|
|
};
|
|
UIButton *button = [[UIButton alloc] init];
|
|
NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:title];
|
|
[attributedTitle setAttributes:buttonTextAttributes range:NSMakeRange(0, [attributedTitle length])];
|
|
[button setAttributedTitle:attributedTitle forState:UIControlStateNormal];
|
|
|
|
NSDictionary *disabledAttributes = @{
|
|
NSFontAttributeName : [UIFont ows_regularFontWithSize:15.0f],
|
|
NSForegroundColorAttributeName : [UIColor ows_darkGrayColor]
|
|
};
|
|
NSMutableAttributedString *attributedTitleDisabled = [[NSMutableAttributedString alloc] initWithString:title];
|
|
[attributedTitleDisabled setAttributes:disabledAttributes range:NSMakeRange(0, [attributedTitle length])];
|
|
[button setAttributedTitle:attributedTitleDisabled forState:UIControlStateDisabled];
|
|
|
|
[button.titleLabel setTextAlignment:NSTextAlignmentCenter];
|
|
|
|
return button;
|
|
}
|
|
|
|
@end
|