8 Commits

Author SHA1 Message Date
E L V I S 6f0ead5af5 Update Lightbox.podspec 2020-07-09 19:47:10 -05:00
E L V I S 4a70c08f37 Merge pull request #254 from hyperoslo/force-modalPresentationStyle
Force modal presentation style
2020-07-09 19:46:46 -05:00
Elvis 7830a7512a Add comment 2020-07-09 19:45:55 -05:00
Elvis 2bb85661b1 Force usage of modalPresentationStyle 2020-07-09 19:44:03 -05:00
Elvis dbffe4f688 Update demo to fix broken link and to show label bug 2020-06-22 08:29:04 -05:00
Elvis ed69a9fdee Add navigation controller to demo 2020-06-22 08:22:00 -05:00
E L V I S 6344062be2 Update Lightbox.podspec 2020-06-22 08:17:15 -05:00
Elvis 8dcf50b722 Add backup symbol for play button 2020-06-22 08:16:07 -05:00
5 changed files with 46 additions and 27 deletions
+1 -1
View File
@@ -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" }
+4
View File
@@ -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
+13 -1
View File
@@ -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
+1 -1
View File
@@ -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?
+27 -24
View File
@@ -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)
}
}