mirror of https://github.com/oxen-io/session-ios
				
				
				
			Send button disabled color and dynamically sized
Using upstream button and change notification allows us to delete some code. // FREEBIEpull/1/head
							parent
							
								
									f8d65ab0f5
								
							
						
					
					
						commit
						4ccb295dbb
					
				@ -1,15 +0,0 @@
 | 
			
		||||
//
 | 
			
		||||
//  UIButton+OWS.h
 | 
			
		||||
//  Signal
 | 
			
		||||
//
 | 
			
		||||
//  Created by Christine Corbett Moran on 2/10/15.
 | 
			
		||||
//  Copyright (c) 2013 Open Whisper Systems. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <UIKit/UIKit.h>
 | 
			
		||||
 | 
			
		||||
@interface UIButton (OWS)
 | 
			
		||||
 | 
			
		||||
+ (UIButton *)ows_blueButtonWithTitle:(NSString *)title;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
@ -1,37 +0,0 @@
 | 
			
		||||
//
 | 
			
		||||
//  UIButton+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 "UIColor+OWS.h"
 | 
			
		||||
#import "UIFont+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
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue