Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f0ead5af5 | |||
| 4a70c08f37 | |||
| 7830a7512a | |||
| 2bb85661b1 | |||
| dbffe4f688 | |||
| ed69a9fdee | |||
| 6344062be2 | |||
| 8dcf50b722 |
+1
-1
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Lightbox"
|
||||
s.summary = "A a convenient and easy to use image viewer for your iOS app, packed with all the features you expect"
|
||||
s.version = "2.4.0"
|
||||
s.version = "2.4.2"
|
||||
s.homepage = "https://github.com/hyperoslo/Lightbox"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" }
|
||||
|
||||
@@ -166,6 +166,10 @@ open class LightboxController: UIViewController {
|
||||
open override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// 9 July 2020: @3lvis
|
||||
// Lightbox hasn't been optimized to be used in presentation styles other than fullscreen.
|
||||
modalPresentationStyle = .fullScreen
|
||||
|
||||
statusBarHidden = UIApplication.shared.isStatusBarHidden
|
||||
|
||||
view.backgroundColor = UIColor.black
|
||||
|
||||
@@ -22,8 +22,20 @@ class PageView: UIScrollView {
|
||||
lazy var playButton: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
button.frame.size = CGSize(width: 60, height: 60)
|
||||
button.setBackgroundImage(AssetManager.image("lightbox_play"), for: UIControl.State())
|
||||
var buttonImage = AssetManager.image("lightbox_play")
|
||||
|
||||
// Note by Elvis Nuñez on Mon 22 Jun 08:06
|
||||
// When using SPM you might find that assets are note included. This is a workaround to provide default assets
|
||||
// under iOS 13 so using SPM can work without problems.
|
||||
if #available(iOS 13.0, *) {
|
||||
if buttonImage == nil {
|
||||
buttonImage = UIImage(systemName: "play.circle.fill")
|
||||
}
|
||||
}
|
||||
|
||||
button.setBackgroundImage(buttonImage, for: UIControl.State())
|
||||
button.addTarget(self, action: #selector(playButtonTouched(_:)), for: .touchUpInside)
|
||||
button.tintColor = .white
|
||||
|
||||
button.layer.shadowOffset = CGSize(width: 1, height: 1)
|
||||
button.layer.shadowColor = UIColor.gray.cgColor
|
||||
|
||||
@@ -3,7 +3,7 @@ import UIKit
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
lazy var controller: UIViewController = ViewController()
|
||||
lazy var controller: UINavigationController = UINavigationController(rootViewController: ViewController())
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
@@ -21,33 +21,36 @@ class ViewController: UIViewController {
|
||||
view.autoresizingMask = [.flexibleTopMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleBottomMargin]
|
||||
view.backgroundColor = UIColor.white
|
||||
view.addSubview(showButton)
|
||||
title = "Lightbox"
|
||||
}
|
||||
|
||||
// MARK: - Action methods
|
||||
|
||||
@objc func showLightbox() {
|
||||
let images = [
|
||||
LightboxImage(imageURL: URL(string: "https://cdn.arstechnica.net/2011/10/05/iphone4s_sample_apple-4e8c706-intro.jpg")!),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo1")!,
|
||||
text: "Photography is the science, art, application and practice of creating durable images by recording light or other electromagnetic radiation, either electronically by means of an image sensor, or chemically by means of a light-sensitive material such as photographic film"
|
||||
),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo2")!,
|
||||
text: "Emoji 😍 (/ɪˈmoʊdʒi/; singular emoji, plural emoji or emojis;[4] from the Japanese 絵文字えもじ, pronounced [emodʑi]) are ideograms and smileys used in electronic messages and web pages. Emoji are used much like emoticons and exist in various genres, including facial expressions, common objects, places and types of weather 🌅☔️💦, and animals 🐶🐱",
|
||||
videoURL: URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
|
||||
),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo3")!,
|
||||
text: "A lightbox is a translucent surface illuminated from behind, used for situations where a shape laid upon the surface needs to be seen with high contrast."
|
||||
)
|
||||
]
|
||||
|
||||
let controller = LightboxController(images: images)
|
||||
controller.modalPresentationStyle = .fullScreen
|
||||
controller.dynamicBackground = true
|
||||
|
||||
present(controller, animated: true, completion: nil)
|
||||
}
|
||||
@objc func showLightbox() {
|
||||
let images = [
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo1")!,
|
||||
text: "Photography is the science, art, application and practice of creating durable images by recording light or other electromagnetic radiation, either electronically by means of an image sensor, or chemically by means of a light-sensitive material such as photographic film"
|
||||
),
|
||||
|
||||
LightboxImage(imageURL: URL(string: "https://via.placeholder.com/300.png/09f/fff")!),
|
||||
|
||||
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo2")!,
|
||||
text: "Emoji 😍 (/ɪˈmoʊdʒi/; singular emoji, plural emoji or emojis;[4] from the Japanese 絵文字えもじ, pronounced [emodʑi]) are ideograms and smileys used in electronic messages and web pages. Emoji are used much like emoticons and exist in various genres, including facial expressions, common objects, places and types of weather 🌅☔️💦, and animals 🐶🐱",
|
||||
videoURL: URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
|
||||
),
|
||||
LightboxImage(
|
||||
image: UIImage(named: "photo3")!,
|
||||
text: "A lightbox is a translucent surface illuminated from behind, used for situations where a shape laid upon the surface needs to be seen with high contrast."
|
||||
)
|
||||
]
|
||||
|
||||
let controller = LightboxController(images: images)
|
||||
controller.dynamicBackground = true
|
||||
|
||||
present(controller, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user