This file contains hidden or 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
let companyArray = ["Google", "Amazon", "Apple", "AirBnb", "Instagram", "Facebook", "Stripe", "Microsoft", "Twitter", "Snap"] |
This file contains hidden or 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
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
view.addSubview(scrollView) | |
imageArray = ["Your Image","Your Image")] | |
setupImages(imageArray) |
This file contains hidden or 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
func setupImages(_ images: [UIImage]){ | |
for i in 0..<images.count { | |
let imageView = UIImageView() | |
imageView.image = images[i] | |
let xPosition = UIScreen.main.bounds.width * CGFloat(i) | |
imageView.frame = CGRect(x: xPosition, y: 0, width: scrollView.frame.width, height: scrollView.frame.height) | |
imageView.contentMode = .scaleAspectFit |
This file contains hidden or 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
imageArray = [UIImage(named:"yourimagename"), UIImage(named: "yourimagename")] |
This file contains hidden or 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
import UIKit | |
class ViewController: UIViewController { | |
var imageArray = [UIImage]() | |
... |
This file contains hidden or 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
import UIKit | |
class ViewController: UIViewController { | |
let scrollView: UIScrollView = { | |
let scroll = UIScrollView() | |
scroll.isPagingEnabled = true | |
scroll.showsVerticalScrollIndicator = false | |
scroll.showsHorizontalScrollIndicator = false | |
scroll.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) |
This file contains hidden or 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
// Inside viewDidLoad | |
view.backgroundColor = UIColor.white |
This file contains hidden or 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
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
window = UIWindow(frame: UIScreen.main.bounds) | |
self.window?.rootViewController = viewController() | |
self.window?.makeKeyAndVisible() |
This file contains hidden or 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
window = UIWindow(frame: UIScreen.main.bounds) | |
window?.rootViewController = UINavigationController(rootViewController: YourTabBarController()) | |
window?.makeKeyAndVisible() |
This file contains hidden or 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
let firstViewController = firstVC() | |
firstViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .search, tag: 0) | |
let secondViewController = secondVC() | |
secondViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .more, tag: 1) | |
let tabBarList = [firstViewController, secondViewController] |