summaryrefslogtreecommitdiff
path: root/Juick/Helpers/JJJAuthorizationField.m
blob: 1173d8b9b046e776fdb225d9291d39d9fbac967a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
//  JJJAuthorizationField.m
//  Juick
//
//  Created by Vitaly Takmazov on 15.05.2020.
//  Copyright © 2020 com.juick. All rights reserved.
//

#import "JJJAuthorizationField.h"

@implementation JJJAuthorizationField

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        [self setup];
    }
    return self;
}

- (void)setup
{
    self.button = [ASAuthorizationAppleIDButton new];
    [self addSubview:self.button];
    self.translatesAutoresizingMaskIntoConstraints = NO;
    self.button.translatesAutoresizingMaskIntoConstraints = NO;
    [NSLayoutConstraint activateConstraints:@[
        [self.widthAnchor constraintEqualToConstant:250.0],
        [self.heightAnchor constraintEqualToConstant:46.0],
        [self.button.topAnchor constraintEqualToAnchor:self.button.superview.topAnchor constant:0.0],
        [self.button.bottomAnchor constraintEqualToAnchor:self.self.button.superview.bottomAnchor constant:0.0],
        [self.button.trailingAnchor constraintEqualToAnchor:self.self.button.superview.trailingAnchor constant:0.0],
        [self.button.leadingAnchor constraintEqualToAnchor:self.self.button.superview.leadingAnchor constant:0.0]
    ]];
}

@end