Converted whole project to Xcode 8 and Swift 3
This commit is contained in:
parent
49f963b687
commit
1e73449c46
|
|
@ -1,7 +1,7 @@
|
|||
language: objective-c
|
||||
osx_image: xcode7.3
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- DESTINATION="OS=9.3,name=iPhone 6s" SCHEME="XLPagerTabStrip" SDK=iphonesimulator9.3
|
||||
- DESTINATION="OS=10.0,name=iPhone 6s" SCHEME="XLPagerTabStrip" SDK=iphonesimulator10.0
|
||||
before_install:
|
||||
- brew update
|
||||
#- brew outdated carthage || brew upgrade carthage
|
||||
|
|
@ -10,7 +10,7 @@ before_install:
|
|||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||
|
||||
script:
|
||||
- xctool clean build -project XLPagerTabStrip.xcodeproj -scheme XLPagerTabStrip -sdk iphonesimulator9.3
|
||||
#- xctool test -project XLPagerTabStrip.xcodeproj -scheme XLPagerTabStrip -sdk iphonesimulator9.3
|
||||
- xcodebuild clean build -project XLPagerTabStrip.xcodeproj -scheme "$SCHEME" -sdk "$SDK"
|
||||
#- xcodebuild test -project XLPagerTabStrip.xcodeproj -scheme "$SCHEME" -sdk "$SDK"
|
||||
- xcodebuild -project XLPagerTabStrip.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
|
||||
-configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c
|
||||
|
|
|
|||
|
|
@ -295,13 +295,15 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0720;
|
||||
LastUpgradeCheck = 0800;
|
||||
TargetAttributes = {
|
||||
28F828CB1C4B714D00330CF4 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
28F828DF1C4B714D00330CF4 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
LastSwiftMigration = 0800;
|
||||
TestTargetID = 28F828CB1C4B714D00330CF4;
|
||||
};
|
||||
};
|
||||
|
|
@ -441,8 +443,10 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
|
@ -485,8 +489,10 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
|
@ -505,6 +511,7 @@
|
|||
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
|
|
@ -512,29 +519,31 @@
|
|||
28F828EA1C4B714D00330CF4 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Example/Example/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
28F828EB1C4B714D00330CF4 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Example/Example/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Example;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
@ -547,6 +556,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_TARGET_NAME = Example;
|
||||
USES_XCTRUNNER = YES;
|
||||
};
|
||||
|
|
@ -560,6 +570,7 @@
|
|||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.ExampleUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_TARGET_NAME = Example;
|
||||
USES_XCTRUNNER = YES;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,36 +13,36 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
|
||||
UITabBar.appearance().tintColor = UIColor.init(red: 0.027, green: 0.725, blue: 0.608, alpha: 1)
|
||||
UIApplication.sharedApplication().statusBarStyle = .LightContent
|
||||
UIApplication.shared.statusBarStyle = .lightContent
|
||||
|
||||
let _ = YoutubeExampleViewController(nibName: nil, bundle: nil)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(application: UIApplication) {
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(application: UIApplication) {
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(application: UIApplication) {
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class BarExampleViewController: BarPagerTabStripViewController {
|
|||
override func viewDidLoad() {
|
||||
|
||||
// set up style before super view did load is executed
|
||||
settings.style.selectedBarBackgroundColor = .orangeColor()
|
||||
settings.style.selectedBarBackgroundColor = .orange
|
||||
// -
|
||||
|
||||
super.viewDidLoad()
|
||||
|
|
@ -43,11 +43,11 @@ class BarExampleViewController: BarPagerTabStripViewController {
|
|||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2")
|
||||
let child_4 = ChildExampleViewController(itemInfo: "View 2")
|
||||
|
||||
guard isReload else {
|
||||
|
|
@ -55,24 +55,24 @@ class BarExampleViewController: BarPagerTabStripViewController {
|
|||
}
|
||||
|
||||
var childViewControllers = [child_1, child_2, child_3, child_4]
|
||||
for (index, _) in childViewControllers.enumerate(){
|
||||
for (index, _) in childViewControllers.enumerated(){
|
||||
let nElements = childViewControllers.count - index
|
||||
let n = (Int(arc4random()) % nElements) + index
|
||||
if n != index{
|
||||
swap(&childViewControllers[index], &childViewControllers[n])
|
||||
}
|
||||
}
|
||||
let nItems = 1 + (rand() % 4)
|
||||
let nItems = 1 + (arc4random() % 4)
|
||||
return Array(childViewControllers.prefix(Int(nItems)))
|
||||
}
|
||||
|
||||
override func reloadPagerTabStripView() {
|
||||
isReload = true
|
||||
if rand() % 2 == 0 {
|
||||
pagerBehaviour = .Progressive(skipIntermediateViewControllers: rand() % 2 == 0 , elasticIndicatorLimit: rand() % 2 == 0 )
|
||||
if arc4random() % 2 == 0 {
|
||||
pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0 , elasticIndicatorLimit: arc4random() % 2 == 0 )
|
||||
}
|
||||
else {
|
||||
pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0)
|
||||
pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
|
||||
}
|
||||
super.reloadPagerTabStripView()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,20 +32,20 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
buttonBarView.selectedBar.backgroundColor = .orangeColor()
|
||||
buttonBarView.selectedBar.backgroundColor = .orange
|
||||
buttonBarView.backgroundColor = UIColor(red: 7/255, green: 185/255, blue: 155/255, alpha: 1)
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2")
|
||||
let child_4 = ChildExampleViewController(itemInfo: "View 2")
|
||||
let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View 3")
|
||||
let child_5 = TableChildExampleViewController(style: .plain, itemInfo: "Table View 3")
|
||||
let child_6 = ChildExampleViewController(itemInfo: "View 3")
|
||||
let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 4")
|
||||
let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 4")
|
||||
let child_8 = ChildExampleViewController(itemInfo: "View 4")
|
||||
|
||||
guard isReload else {
|
||||
|
|
@ -54,24 +54,24 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
|
||||
var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
|
||||
|
||||
for (index, _) in childViewControllers.enumerate(){
|
||||
for (index, _) in childViewControllers.enumerated(){
|
||||
let nElements = childViewControllers.count - index
|
||||
let n = (Int(arc4random()) % nElements) + index
|
||||
if n != index{
|
||||
swap(&childViewControllers[index], &childViewControllers[n])
|
||||
}
|
||||
}
|
||||
let nItems = 1 + (rand() % 8)
|
||||
let nItems = 1 + (arc4random() % 8)
|
||||
return Array(childViewControllers.prefix(Int(nItems)))
|
||||
}
|
||||
|
||||
override func reloadPagerTabStripView() {
|
||||
isReload = true
|
||||
if rand() % 2 == 0 {
|
||||
pagerBehaviour = .Progressive(skipIntermediateViewControllers: rand() % 2 == 0 , elasticIndicatorLimit: rand() % 2 == 0 )
|
||||
if arc4random() % 2 == 0 {
|
||||
pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0 , elasticIndicatorLimit: arc4random() % 2 == 0 )
|
||||
}
|
||||
else {
|
||||
pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0)
|
||||
pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
|
||||
}
|
||||
super.reloadPagerTabStripView()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,15 +46,15 @@ class ChildExampleViewController: UIViewController, IndicatorInfoProvider {
|
|||
label.text = "XLPagerTabStrip"
|
||||
|
||||
view.addSubview(label)
|
||||
view.backgroundColor = .whiteColor()
|
||||
view.backgroundColor = .white
|
||||
|
||||
view.addConstraint(NSLayoutConstraint(item: label, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1, constant: 0))
|
||||
view.addConstraint(NSLayoutConstraint(item: label, attribute: .CenterY, relatedBy: .Equal, toItem: view, attribute: .CenterY, multiplier: 1, constant: -50))
|
||||
view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0))
|
||||
view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: -50))
|
||||
}
|
||||
|
||||
// MARK: - IndicatorInfoProvider
|
||||
|
||||
func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
func indicatorInfoForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
return itemInfo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
tableView.registerNib(UINib(nibName: "PostCell", bundle: NSBundle.mainBundle()), forCellReuseIdentifier: cellIdentifier)
|
||||
tableView.register(UINib(nibName: "PostCell", bundle: Bundle.main), forCellReuseIdentifier: cellIdentifier)
|
||||
tableView.estimatedRowHeight = 60.0;
|
||||
tableView.rowHeight = UITableViewAutomaticDimension
|
||||
tableView.allowsSelection = false
|
||||
|
|
@ -51,24 +51,24 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi
|
|||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
// MARK: - UITableViewDataSource
|
||||
|
||||
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return DataProvider.sharedInstance.postsData.count
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! PostCell
|
||||
let data = DataProvider.sharedInstance.postsData.objectAtIndex(indexPath.row) as!
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! PostCell
|
||||
let data = DataProvider.sharedInstance.postsData.object(at: indexPath.row) as!
|
||||
NSDictionary
|
||||
cell.configureWithData(data)
|
||||
if blackTheme {
|
||||
|
|
@ -79,7 +79,7 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi
|
|||
|
||||
// MARK: - IndicatorInfoProvider
|
||||
|
||||
func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
func indicatorInfoForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
return itemInfo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -37,18 +37,20 @@ class PostCell: UITableViewCell {
|
|||
}
|
||||
|
||||
|
||||
func configureWithData(data: NSDictionary){
|
||||
postName.text = data["post"]!["user"]!!["name"] as? String
|
||||
postText.text = data["post"]!["text"] as? String
|
||||
userImage.image = UIImage(named: postName.text!.stringByReplacingOccurrencesOfString(" ", withString: "_"))
|
||||
func configureWithData(_ data: NSDictionary){
|
||||
if let post = data["post"] as? NSDictionary, let user = post["user"] as? NSDictionary {
|
||||
postName.text = user["name"] as? String
|
||||
postText.text = post["text"] as? String
|
||||
userImage.image = UIImage(named: postName.text!.replacingOccurrences(of: " ", with: "_"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func changeStylToBlack(){
|
||||
userImage?.layer.cornerRadius = 30.0
|
||||
postText.text = nil
|
||||
postName.font = UIFont(name: "HelveticaNeue-Light", size:18) ?? UIFont.systemFontOfSize(18)
|
||||
postName.textColor = .whiteColor()
|
||||
postName.font = UIFont(name: "HelveticaNeue-Light", size:18) ?? UIFont.systemFont(ofSize: 18)
|
||||
postName.textColor = .white
|
||||
backgroundColor = UIColor(red: 15/255.0, green: 16/255.0, blue: 16/255.0, alpha: 1.0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,20 +32,20 @@ class InstagramExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
// change selected bar color
|
||||
settings.style.buttonBarBackgroundColor = .whiteColor()
|
||||
settings.style.buttonBarItemBackgroundColor = .whiteColor()
|
||||
settings.style.buttonBarBackgroundColor = .white
|
||||
settings.style.buttonBarItemBackgroundColor = .white
|
||||
settings.style.selectedBarBackgroundColor = blueInstagramColor
|
||||
settings.style.buttonBarItemFont = .boldSystemFontOfSize(14)
|
||||
settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14)
|
||||
settings.style.selectedBarHeight = 2.0
|
||||
settings.style.buttonBarMinimumLineSpacing = 0
|
||||
settings.style.buttonBarItemTitleColor = .blackColor()
|
||||
settings.style.buttonBarItemTitleColor = .black
|
||||
settings.style.buttonBarItemsShouldFillAvailiableWidth = true
|
||||
settings.style.buttonBarLeftContentInset = 0
|
||||
settings.style.buttonBarRightContentInset = 0
|
||||
|
||||
changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
|
||||
guard changeCurrentIndex == true else { return }
|
||||
oldCell?.label.textColor = .blackColor()
|
||||
oldCell?.label.textColor = .black
|
||||
newCell?.label.textColor = self?.blueInstagramColor
|
||||
}
|
||||
super.viewDidLoad()
|
||||
|
|
@ -53,16 +53,16 @@ class InstagramExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "FOLLOWING")
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "FOLLOWING")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "YOU")
|
||||
return [child_1, child_2]
|
||||
}
|
||||
|
||||
// MARK: - Custom Action
|
||||
|
||||
@IBAction func closeAction(sender: UIButton) {
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
@IBAction func closeAction(_ sender: UIButton) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
// set up style before super view did load is executed
|
||||
settings.style.buttonBarBackgroundColor = .clearColor()
|
||||
settings.style.selectedBarBackgroundColor = .orangeColor()
|
||||
settings.style.buttonBarBackgroundColor = .clear
|
||||
settings.style.selectedBarBackgroundColor = .orange
|
||||
//-
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
@ -42,31 +42,31 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
guard changeCurrentIndex == true else { return }
|
||||
|
||||
oldCell?.label.textColor = UIColor(white: 1, alpha: 0.6)
|
||||
newCell?.label.textColor = .whiteColor()
|
||||
newCell?.label.textColor = .white
|
||||
|
||||
if animated {
|
||||
UIView.animateWithDuration(0.1, animations: { () -> Void in
|
||||
newCell?.transform = CGAffineTransformMakeScale(1.0, 1.0)
|
||||
oldCell?.transform = CGAffineTransformMakeScale(0.8, 0.8)
|
||||
UIView.animate(withDuration: 0.1, animations: { () -> Void in
|
||||
newCell?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
|
||||
oldCell?.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
|
||||
})
|
||||
}
|
||||
else {
|
||||
newCell?.transform = CGAffineTransformMakeScale(1.0, 1.0)
|
||||
oldCell?.transform = CGAffineTransformMakeScale(0.8, 0.8)
|
||||
newCell?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
|
||||
oldCell?.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2")
|
||||
let child_4 = ChildExampleViewController(itemInfo: "View 1")
|
||||
let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View 3")
|
||||
let child_5 = TableChildExampleViewController(style: .plain, itemInfo: "Table View 3")
|
||||
let child_6 = ChildExampleViewController(itemInfo: "View 2")
|
||||
let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 4")
|
||||
let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 4")
|
||||
let child_8 = ChildExampleViewController(itemInfo: "View 3")
|
||||
|
||||
guard isReload else {
|
||||
|
|
@ -75,30 +75,30 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
|
||||
var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
|
||||
|
||||
for (index, _) in childViewControllers.enumerate(){
|
||||
for (index, _) in childViewControllers.enumerated(){
|
||||
let nElements = childViewControllers.count - index
|
||||
let n = (Int(arc4random()) % nElements) + index
|
||||
if n != index{
|
||||
swap(&childViewControllers[index], &childViewControllers[n])
|
||||
}
|
||||
}
|
||||
let nItems = 1 + (rand() % 8)
|
||||
let nItems = 1 + (arc4random() % 8)
|
||||
return Array(childViewControllers.prefix(Int(nItems)))
|
||||
}
|
||||
|
||||
override func reloadPagerTabStripView() {
|
||||
isReload = true
|
||||
if rand() % 2 == 0 {
|
||||
pagerBehaviour = .Progressive(skipIntermediateViewControllers: rand() % 2 == 0 , elasticIndicatorLimit: rand() % 2 == 0 )
|
||||
if arc4random() % 2 == 0 {
|
||||
pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0 , elasticIndicatorLimit: arc4random() % 2 == 0 )
|
||||
}
|
||||
else {
|
||||
pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0)
|
||||
pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
|
||||
}
|
||||
super.reloadPagerTabStripView()
|
||||
}
|
||||
|
||||
override func configureCell(cell: ButtonBarViewCell, indicatorInfo: IndicatorInfo) {
|
||||
override func configureCell(_ cell: ButtonBarViewCell, indicatorInfo: IndicatorInfo) {
|
||||
super.configureCell(cell, indicatorInfo: indicatorInfo)
|
||||
cell.backgroundColor = .clearColor()
|
||||
cell.backgroundColor = .clear
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ class ReloadExampleViewController: UIViewController {
|
|||
|
||||
lazy var bigLabel: UILabel = {
|
||||
let bigLabel = UILabel()
|
||||
bigLabel.backgroundColor = .clearColor()
|
||||
bigLabel.textColor = .whiteColor()
|
||||
bigLabel.font = UIFont.boldSystemFontOfSize(20)
|
||||
bigLabel.backgroundColor = .clear
|
||||
bigLabel.textColor = .white
|
||||
bigLabel.font = UIFont.boldSystemFont(ofSize: 20)
|
||||
bigLabel.adjustsFontSizeToFitWidth = true
|
||||
return bigLabel
|
||||
}()
|
||||
|
|
@ -54,7 +54,7 @@ class ReloadExampleViewController: UIViewController {
|
|||
}
|
||||
}
|
||||
|
||||
@IBAction func reloadTapped(sender: UIBarButtonItem) {
|
||||
@IBAction func reloadTapped(_ sender: UIBarButtonItem) {
|
||||
for childViewController in childViewControllers {
|
||||
guard let child = childViewController as? PagerTabStripViewController else {
|
||||
continue
|
||||
|
|
@ -66,12 +66,12 @@ class ReloadExampleViewController: UIViewController {
|
|||
}
|
||||
|
||||
|
||||
@IBAction func closeTapped(sender: UIButton) {
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
@IBAction func closeTapped(_ sender: UIButton) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func updateTitle(pagerTabStripViewController: PagerTabStripViewController) {
|
||||
func stringFromBool(bool: Bool) -> String {
|
||||
func updateTitle(_ pagerTabStripViewController: PagerTabStripViewController) {
|
||||
func stringFromBool(_ bool: Bool) -> String {
|
||||
return bool ? "YES" : "NO"
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class ReloadExampleViewController: UIViewController {
|
|||
navigationItem.titleView?.sizeToFit()
|
||||
}
|
||||
|
||||
override func preferredStatusBarStyle() -> UIStatusBarStyle {
|
||||
return .LightContent
|
||||
override var preferredStatusBarStyle : UIStatusBarStyle {
|
||||
return .lightContent
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController {
|
|||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
// change segmented style
|
||||
settings.style.segmentedControlColor = .whiteColor()
|
||||
settings.style.segmentedControlColor = .white
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "Table View 2")
|
||||
let child_4 = ChildExampleViewController(itemInfo: "View 2")
|
||||
|
||||
guard isReload else {
|
||||
|
|
@ -50,21 +50,20 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController {
|
|||
var childViewControllers = [child_1, child_2, child_3, child_4]
|
||||
let count = childViewControllers.count
|
||||
|
||||
for (index, _) in childViewControllers.enumerate(){
|
||||
for (index, _) in childViewControllers.enumerated(){
|
||||
let nElements = count - index
|
||||
let n = (Int(arc4random()) % nElements) + index
|
||||
if n != index{
|
||||
swap(&childViewControllers[index], &childViewControllers[n])
|
||||
}
|
||||
}
|
||||
let nItems = 1 + (rand() % 4)
|
||||
let nItems = 1 + (arc4random() % 4)
|
||||
return Array(childViewControllers.prefix(Int(nItems)))
|
||||
}
|
||||
|
||||
@IBAction func reloadTapped(sender: UIBarButtonItem) {
|
||||
@IBAction func reloadTapped(_ sender: UIBarButtonItem) {
|
||||
isReload = true
|
||||
pagerBehaviour = .Common(skipIntermediateViewControllers: rand() % 2 == 0)
|
||||
pagerBehaviour.skipIntermediateViewControllers
|
||||
pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
|
||||
reloadPagerTabStripView()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,22 +25,22 @@
|
|||
import Foundation
|
||||
import XLPagerTabStrip
|
||||
|
||||
public class SpotifyExampleViewController: ButtonBarPagerTabStripViewController {
|
||||
open class SpotifyExampleViewController: ButtonBarPagerTabStripViewController {
|
||||
|
||||
@IBOutlet weak var shadowView: UIView!
|
||||
|
||||
let graySpotifyColor = UIColor(red: 21/255.0, green: 21/255.0, blue: 24/255.0, alpha: 1.0)
|
||||
let darkGraySpotifyColor = UIColor(red: 19/255.0, green: 20/255.0, blue: 20/255.0, alpha: 1.0)
|
||||
|
||||
public override func viewDidLoad() {
|
||||
open override func viewDidLoad() {
|
||||
// change selected bar color
|
||||
settings.style.buttonBarBackgroundColor = graySpotifyColor
|
||||
settings.style.buttonBarItemBackgroundColor = graySpotifyColor
|
||||
settings.style.selectedBarBackgroundColor = UIColor(red: 33/255.0, green: 174/255.0, blue: 67/255.0, alpha: 1.0)
|
||||
settings.style.buttonBarItemFont = UIFont(name: "HelveticaNeue-Light", size:14) ?? UIFont.systemFontOfSize(14)
|
||||
settings.style.buttonBarItemFont = UIFont(name: "HelveticaNeue-Light", size:14) ?? UIFont.systemFont(ofSize: 14)
|
||||
settings.style.selectedBarHeight = 3.0
|
||||
settings.style.buttonBarMinimumLineSpacing = 0
|
||||
settings.style.buttonBarItemTitleColor = .blackColor()
|
||||
settings.style.buttonBarItemTitleColor = .black
|
||||
settings.style.buttonBarItemsShouldFillAvailiableWidth = true
|
||||
|
||||
settings.style.buttonBarLeftContentInset = 20
|
||||
|
|
@ -49,25 +49,25 @@ public class SpotifyExampleViewController: ButtonBarPagerTabStripViewController
|
|||
changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
|
||||
guard changeCurrentIndex == true else { return }
|
||||
oldCell?.label.textColor = UIColor(red: 138/255.0, green: 138/255.0, blue: 144/255.0, alpha: 1.0)
|
||||
newCell?.label.textColor = .whiteColor()
|
||||
newCell?.label.textColor = .white
|
||||
}
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
public override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: "FRIENDS"))
|
||||
open override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: "FRIENDS"))
|
||||
child_1.blackTheme = true
|
||||
let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: "FEATURED"))
|
||||
let child_2 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: "FEATURED"))
|
||||
child_2.blackTheme = true
|
||||
return [child_1, child_2]
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@IBAction func closeAction(sender: UIButton) {
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
@IBAction func closeAction(_ sender: UIButton) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ import XLPagerTabStrip
|
|||
class TwitterExampleViewController: TwitterPagerTabStripViewController {
|
||||
var isReload = false
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView")
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: "TableView")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "TableView 2")
|
||||
let child_3 = TableChildExampleViewController(style: .grouped, itemInfo: "TableView 2")
|
||||
let child_4 = ChildExampleViewController(itemInfo: "View 2")
|
||||
let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView 3")
|
||||
let child_5 = TableChildExampleViewController(style: .plain, itemInfo: "TableView 3")
|
||||
let child_6 = ChildExampleViewController(itemInfo: "View 3")
|
||||
let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "TableView 4")
|
||||
let child_7 = TableChildExampleViewController(style: .grouped, itemInfo: "TableView 4")
|
||||
let child_8 = ChildExampleViewController(itemInfo: "View 4")
|
||||
|
||||
guard isReload else {
|
||||
|
|
@ -45,18 +45,18 @@ class TwitterExampleViewController: TwitterPagerTabStripViewController {
|
|||
|
||||
var childViewControllers = [child_1, child_2, child_3, child_4, child_6, child_7, child_8]
|
||||
|
||||
for (index, _) in childViewControllers.enumerate(){
|
||||
for (index, _) in childViewControllers.enumerated(){
|
||||
let nElements = childViewControllers.count - index
|
||||
let n = (Int(arc4random()) % nElements) + index
|
||||
if n != index{
|
||||
swap(&childViewControllers[index], &childViewControllers[n])
|
||||
}
|
||||
}
|
||||
let nItems = 1 + (rand() % 8)
|
||||
let nItems = 1 + (arc4random() % 8)
|
||||
return Array(childViewControllers.prefix(Int(nItems)))
|
||||
}
|
||||
|
||||
@IBAction func reloadTapped(sender: AnyObject) {
|
||||
@IBAction func reloadTapped(_ sender: AnyObject) {
|
||||
isReload = true
|
||||
reloadPagerTabStripView()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
let unselectedIconColor = UIColor(red: 73/255.0, green: 8/255.0, blue: 10/255.0, alpha: 1.0)
|
||||
|
||||
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
|
||||
buttonBarItemSpec = ButtonBarItemSpec.NibFile(nibName: "YoutubeIconCell", bundle: NSBundle(forClass: YoutubeIconCell.self), width: { (cell: IndicatorInfo) -> CGFloat in
|
||||
buttonBarItemSpec = ButtonBarItemSpec.nibFile(nibName: "YoutubeIconCell", bundle: Bundle(for: YoutubeIconCell.self), width: { (cell: IndicatorInfo) -> CGFloat in
|
||||
return 55.0
|
||||
})
|
||||
}
|
||||
|
|
@ -46,11 +46,11 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
override func viewDidLoad() {
|
||||
// change selected bar color
|
||||
settings.style.buttonBarBackgroundColor = redColor
|
||||
settings.style.buttonBarItemBackgroundColor = .clearColor()
|
||||
settings.style.buttonBarItemBackgroundColor = .clear
|
||||
settings.style.selectedBarBackgroundColor = UIColor(red: 234/255.0, green: 234/255.0, blue: 234/255.0, alpha: 1.0)
|
||||
settings.style.selectedBarHeight = 4.0
|
||||
settings.style.buttonBarMinimumLineSpacing = 0
|
||||
settings.style.buttonBarItemTitleColor = .blackColor()
|
||||
settings.style.buttonBarItemTitleColor = .black
|
||||
settings.style.buttonBarItemsShouldFillAvailiableWidth = true
|
||||
settings.style.buttonBarLeftContentInset = 0
|
||||
settings.style.buttonBarRightContentInset = 0
|
||||
|
|
@ -60,30 +60,30 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
changeCurrentIndexProgressive = { [weak self] (oldCell: YoutubeIconCell?, newCell: YoutubeIconCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
|
||||
guard changeCurrentIndex == true else { return }
|
||||
oldCell?.iconImage.tintColor = self?.unselectedIconColor
|
||||
newCell?.iconImage.tintColor = .whiteColor()
|
||||
newCell?.iconImage.tintColor = .white
|
||||
|
||||
}
|
||||
super.viewDidLoad()
|
||||
navigationController?.navigationBar.shadowImage = UIImage()
|
||||
navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
|
||||
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: " HOME", image: UIImage(named: "home")))
|
||||
let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: " TRENDING", image: UIImage(named: "trending")))
|
||||
override func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: " HOME", image: UIImage(named: "home")))
|
||||
let child_2 = TableChildExampleViewController(style: .plain, itemInfo: IndicatorInfo(title: " TRENDING", image: UIImage(named: "trending")))
|
||||
let child_3 = ChildExampleViewController(itemInfo: IndicatorInfo(title: " ACCOUNT", image: UIImage(named: "profile")))
|
||||
return [child_1, child_2, child_3]
|
||||
}
|
||||
|
||||
|
||||
override func configureCell(cell: YoutubeIconCell, indicatorInfo: IndicatorInfo) {
|
||||
cell.iconImage.image = indicatorInfo.image?.imageWithRenderingMode(.AlwaysTemplate)
|
||||
override func configureCell(_ cell: YoutubeIconCell, indicatorInfo: IndicatorInfo) {
|
||||
cell.iconImage.image = indicatorInfo.image?.withRenderingMode(.alwaysTemplate)
|
||||
}
|
||||
|
||||
|
||||
override func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
|
||||
override func pagerTabStripViewController(_ pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
|
||||
super.pagerTabStripViewController(pagerTabStripViewController, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: progressPercentage, indexWasChanged: indexWasChanged)
|
||||
if indexWasChanged && toIndex > -1 && toIndex < viewControllers.count {
|
||||
let child = viewControllers[toIndex] as! IndicatorInfoProvider
|
||||
|
|
@ -96,8 +96,8 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
|
||||
// MARK: - Actions
|
||||
|
||||
@IBAction func closeAction(sender: UIButton) {
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
@IBAction func closeAction(_ sender: UIButton) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollec
|
|||
flowLayout.sectionInset = UIEdgeInsetsMake(sectionInset.top, self.settings.style.buttonBarLeftContentInset ?? sectionInset.left, sectionInset.bottom, self.settings.style.buttonBarRightContentInset ?? sectionInset.right)
|
||||
buttonBarView.showsHorizontalScrollIndicator = false
|
||||
buttonBarView.backgroundColor = settings.style.buttonBarBackgroundColor ?? buttonBarView.backgroundColor
|
||||
buttonBarView.selectedBar.backgroundColor = settings.style.selectedBarBackgroundColor ?? buttonBarView.selectedBar.backgroundColor
|
||||
buttonBarView.selectedBar.backgroundColor = settings.style.selectedBarBackgroundColor
|
||||
|
||||
buttonBarView.selectedBarHeight = settings.style.selectedBarHeight ?? buttonBarView.selectedBarHeight
|
||||
buttonBarView.selectedBarHeight = settings.style.selectedBarHeight
|
||||
// register button bar item cell
|
||||
switch buttonBarItemSpec! {
|
||||
case .nibFile(let nibName, let bundle, _):
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
buttonBarView.backgroundColor = settings.style.buttonBarBackgroundColor ?? buttonBarView.backgroundColor
|
||||
buttonBarView.selectedBar.backgroundColor = settings.style.selectedBarBackgroundColor
|
||||
|
||||
buttonBarView.selectedBarHeight = settings.style.selectedBarHeight ?? buttonBarView.selectedBarHeight
|
||||
buttonBarView.selectedBarHeight = settings.style.selectedBarHeight
|
||||
// register button bar item cell
|
||||
switch buttonBarItemSpec {
|
||||
case .nibFile(let nibName, let bundle, _):
|
||||
|
|
@ -271,7 +271,7 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
let indicatorInfo = childController.indicatorInfoForPagerTabStrip(self)
|
||||
|
||||
cell.label.text = indicatorInfo.title
|
||||
cell.label.font = settings.style.buttonBarItemFont ?? cell.label.font
|
||||
cell.label.font = settings.style.buttonBarItemFont
|
||||
cell.label.textColor = settings.style.buttonBarItemTitleColor ?? cell.label.textColor
|
||||
cell.contentView.backgroundColor = settings.style.buttonBarItemBackgroundColor ?? cell.contentView.backgroundColor
|
||||
cell.backgroundColor = settings.style.buttonBarItemBackgroundColor ?? cell.backgroundColor
|
||||
|
|
|
|||
Loading…
Reference in New Issue