|
33 | 33 | @interface ABReleaseNotesViewController ()<UIViewControllerTransitioningDelegate> |
34 | 34 | @property(nonatomic,copy) NSString *appIdentifier; |
35 | 35 | @property(nonatomic,strong) ABReleaseNotesDownloader *downloader; |
36 | | -@property(nonatomic,strong) UIView *roundedCornerView; |
37 | | -@property(nonatomic,strong) UIVisualEffectView *vibrancyView; |
38 | 36 | @property(nonatomic,strong) UILabel *titleLabel; |
39 | 37 | @property(nonatomic,strong) UITextView *bodyText; |
40 | 38 | @property(nonatomic,copy) UIColor *lineViewColor; |
@@ -118,52 +116,18 @@ - (void)viewDidLoad { |
118 | 116 | }); |
119 | 117 |
|
120 | 118 | NSString *title = self.mode == ABReleaseNotesViewControllerModeProduction ? self.title : [NSString stringWithFormat:@"TESTING - %@", self.title]; |
121 | | - UINavigationBar *navigationBar = [self createNavigationBarWithTitle:title]; |
| 119 | + UINavigationBar *navigationBar = [self.class createNavigationBarWithTitle:title]; |
122 | 120 |
|
123 | 121 | NSArray *subviews = @[navigationBar, self.bodyText, [self.class makeLineViewWithColor:self.lineViewColor], closeButton]; |
124 | 122 |
|
125 | | - [self createContainerViewsWithContentView:({ |
| 123 | + UIView *view = [self.class createEffectsViewsWithFrame:self.view.bounds blurEffectStyle:self.blurEffectStyle contentView:({ |
126 | 124 | UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:subviews]; |
127 | 125 | stackView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; |
128 | 126 | stackView.axis = UILayoutConstraintAxisVertical; |
129 | 127 | stackView; |
130 | 128 | })]; |
131 | | -} |
132 | | - |
133 | | -- (UINavigationBar*)createNavigationBarWithTitle:(NSString*)title { |
134 | | - UINavigationBar *navigationBar = [[UINavigationBar alloc] init]; |
135 | | - [navigationBar pushNavigationItem:[[UINavigationItem alloc] initWithTitle:title] animated:YES]; |
136 | | - return navigationBar; |
137 | | -} |
138 | | - |
139 | | -- (void)createContainerViewsWithContentView:(UIView*)contentView { |
140 | | - |
141 | | - self.roundedCornerView = [[UIView alloc] initWithFrame:self.view.bounds]; |
142 | | - self.roundedCornerView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; |
143 | | - self.roundedCornerView.clipsToBounds = YES; |
144 | | - self.roundedCornerView.layer.cornerRadius = 8.f; |
145 | | - [self.view addSubview:self.roundedCornerView]; |
146 | | - |
147 | | - UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:self.blurEffectStyle]; |
148 | | - |
149 | | - UIVisualEffectView *background = ({ |
150 | | - UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; |
151 | | - effectView.frame = self.view.bounds; |
152 | | - effectView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; |
153 | | - effectView; |
154 | | - }); |
155 | | - [self.roundedCornerView addSubview:background]; |
156 | | - |
157 | | - self.vibrancyView = ({ |
158 | | - UIVisualEffectView *v = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; |
159 | | - v.frame = background.contentView.bounds; |
160 | | - v.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; |
161 | | - v; |
162 | | - }); |
163 | | - [background.contentView addSubview:self.vibrancyView]; |
164 | 129 |
|
165 | | - contentView.frame = self.vibrancyView.contentView.bounds; |
166 | | - [self.vibrancyView.contentView addSubview:contentView]; |
| 130 | + [self.view addSubview:view]; |
167 | 131 | } |
168 | 132 |
|
169 | 133 | #pragma mark - Actions |
@@ -230,4 +194,44 @@ + (UIView*)makeLineViewWithColor:(UIColor*)color { |
230 | 194 | [v addConstraint:[NSLayoutConstraint constraintWithItem:v attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:0 constant:1]]; |
231 | 195 | return v; |
232 | 196 | } |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | ++ (UINavigationBar*)createNavigationBarWithTitle:(NSString*)title { |
| 201 | + UINavigationBar *navigationBar = [[UINavigationBar alloc] init]; |
| 202 | + [navigationBar pushNavigationItem:[[UINavigationItem alloc] initWithTitle:title] animated:YES]; |
| 203 | + return navigationBar; |
| 204 | +} |
| 205 | + |
| 206 | ++ (UIView*)createEffectsViewsWithFrame:(CGRect)frame blurEffectStyle:(UIBlurEffectStyle)blurEffectStyle contentView:(UIView*)contentView { |
| 207 | + |
| 208 | + UIView *roundedCornerView = [[UIView alloc] initWithFrame:frame]; |
| 209 | + roundedCornerView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; |
| 210 | + roundedCornerView.clipsToBounds = YES; |
| 211 | + roundedCornerView.layer.cornerRadius = 8.f; |
| 212 | + |
| 213 | + UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:blurEffectStyle]; |
| 214 | + |
| 215 | + UIVisualEffectView *background = ({ |
| 216 | + UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; |
| 217 | + effectView.frame = frame; |
| 218 | + effectView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; |
| 219 | + effectView; |
| 220 | + }); |
| 221 | + [roundedCornerView addSubview:background]; |
| 222 | + |
| 223 | + UIVisualEffectView *vibrancyView = ({ |
| 224 | + UIVisualEffectView *v = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; |
| 225 | + v.frame = background.contentView.bounds; |
| 226 | + v.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; |
| 227 | + v; |
| 228 | + }); |
| 229 | + [background.contentView addSubview:vibrancyView]; |
| 230 | + |
| 231 | + contentView.frame = vibrancyView.contentView.bounds; |
| 232 | + [vibrancyView.contentView addSubview:contentView]; |
| 233 | + |
| 234 | + return roundedCornerView; |
| 235 | +} |
| 236 | + |
233 | 237 | @end |
0 commit comments