Minitour / AZTabBarController

A custom tab bar controller for iOS written in Swift 4.2
MIT License
348 stars 65 forks source link

Implementation Problem #3

Closed WrathChaos closed 7 years ago

WrathChaos commented 7 years ago

Hello, I love your library but i couldn't implement it on my project. Can you create a better version of USAGE part ? :) I'm new at iOS and i cannot find how to create AZTabBarController. I really want to use your library.

Thank you :)

Minitour commented 7 years ago

@WrathChaos Hi, can you let me know in what part are you having trouble implementing my library?

Minitour commented 7 years ago

@WrathChaos Anyways you can checkout this ViewController class in which I make use of the library.

Do note that the AZTabBarController can only be initialized programmatically.

WrathChaos commented 7 years ago

@Minitour Hello, sorry for late response :( I'm gonna check your ViewController class but did you create any TabBarController ? or should i just use your library by programmatically?

Minitour commented 7 years ago

@WrathChaos

override func viewDidLoad(){
     super.viewDidLoad()
//Place the code in here
}
//Where icons is an array of UIImage. each image is used as the tab icon. The number of elements in the array is also your number of tabs.
let tabController = AZTabBarController.insert(into: self, withTabIcons: icons)
//initialize your controller
let myViewControllerInstance = CustomViewController()

//if you are initializing from storyboard your code should look like this:
let myViewControllerInstance = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CustomViewController")

//add your controller at a certain tab. This will add your controller at the second tab (because index is 1 and not 0)
tabController.set(viewController: myViewControllerInstance, atIndex: 1)

I hope this can get you started. Feel free to ask questions and let me know when implement it successfully.

WrathChaos commented 7 years ago

@Minitour Thank you so much ! :) I got it now, i will play on it.

Thank you again :)

WrathChaos commented 7 years ago

@Minitour One last question, in your ReadME gif. There is a green center button, can you tell me how can i do something like that?

Minitour commented 7 years ago

@WrathChaos

//your color of choice
let greenColor = #colorLiteral(red: 0.1803921569, green: 0.8, blue: 0.4431372549, alpha: 1)

//set it as the highlighted color (This will change every highlighted button's background color)
tabController.highlightedColor = greenColor

//Make center button highlighted. (since we have 5 buttons are middle index is 2)
tabController.highlightButton(atIndex: 2)
WrathChaos commented 7 years ago

@Minitour Thank you so much, you're the best!

Minitour commented 7 years ago

@WrathChaos Glad to help 😀