Created
October 31, 2017 20:16
-
-
Save bolencki13/3a28eca1584a3e1d9926eab1181f69dc to your computer and use it in GitHub Desktop.
Transparent View Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BTOTransparentViewController.m | |
// | |
// Created by Brian Olencki on 10/31/17. | |
// | |
#import "BTOTransparentViewController.h" | |
@interface BTOTransparentViewController () | |
@end | |
@implementation BTOTransparentViewController | |
- (instancetype)init { | |
self = [super init]; | |
if (self) { | |
self.providesPresentationContextTransitionStyle = YES; | |
self.definesPresentationContext = YES; | |
self.view.backgroundColor = [UIColor clearColor]; | |
self.modalPresentationStyle = UIModalPresentationOverCurrentContext; | |
} | |
return self | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BTOTransparentViewController.swift | |
// | |
// Created by Brian Olencki on 10/31/17. | |
// | |
import UIKit | |
class BTOTransparentViewController: UIViewController { | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
self.providesPresentationContextTransitionStyle = true | |
self.definesPresentationContext = true | |
self.view.backgroundColor = UIColor.clear | |
self.modalPresentationStyle = .overCurrentContext | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment