-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8411793
commit a86d329
Showing
6 changed files
with
80 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
13 changes: 0 additions & 13 deletions
13
Dai-Hentai/ViewControllers/TabBarController/TabBarController.h
This file was deleted.
Oops, something went wrong.
55 changes: 0 additions & 55 deletions
55
Dai-Hentai/ViewControllers/TabBarController/TabBarController.m
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
Dai-Hentai/ViewControllers/TabBarController/TabBarController.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// TabBarController.swift | ||
// Dai-Hentai | ||
// | ||
// Created by DaidoujiChen on 2018/11/27. | ||
// Copyright © 2018 DaidoujiChen. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
class TabBarController: UITabBarController { | ||
|
||
// MARK: - Life Cycle | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
self.delegate = self | ||
var titles = [ "列表", "歷史", "下載", "設定" ] | ||
for view in tabBar.subviews { | ||
if | ||
let tabBarButton = NSClassFromString("UITabBarButton"), | ||
view.isKind(of: tabBarButton), | ||
view.subviews.count == 2 { | ||
|
||
for subview in view.subviews { | ||
if | ||
let tabBarButtonLabel = NSClassFromString("UITabBarButtonLabel"), | ||
subview.isKind(of: tabBarButtonLabel), | ||
subview.respondsOwO("setText:") { | ||
subview.performOwO("setText:", with: titles.first ?? "") | ||
subview.sizeToFit() | ||
titles.remove(at: 0) | ||
break | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
// MARK: - UITabBarControllerDelegate | ||
extension TabBarController: UITabBarControllerDelegate { | ||
|
||
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) { | ||
if | ||
let navigationController = viewController as? UINavigationController, | ||
let settingViewController = navigationController.topViewController as? SettingViewController { | ||
DBUserPreference.setInfo(settingViewController.info) | ||
} | ||
} | ||
|
||
} |