Skip to content

Instantly share code, notes, and snippets.

@bolencki13
Created October 31, 2017 20:16
Show Gist options
  • Save bolencki13/3a28eca1584a3e1d9926eab1181f69dc to your computer and use it in GitHub Desktop.
Save bolencki13/3a28eca1584a3e1d9926eab1181f69dc to your computer and use it in GitHub Desktop.
Transparent View Controller
//
// 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
//
// 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