CosmicMind / Samples

Sample projects using Material, Graph, and Algorithm.
http://cosmicmind.com
BSD 3-Clause "New" or "Revised" License
402 stars 262 forks source link

pageTabBarController #7

Closed calvinsug closed 7 years ago

calvinsug commented 8 years ago
  1. how to change Tab bar position from bottom to top ?
  2. Can i add some button with imageView at tabBar ?
daniel-jonathan commented 8 years ago

Hey,

  1. use the open var pageTabBarAlignment = PageTabBarAlignment.bottom property.
  2. The TabBar takes any buttons you like, they are UIButton types, so you should be able to add an image and text as you please.

:)

daniel-jonathan commented 8 years ago

If you have any further questions, please reopen or create a new issue. Thank you!

calvinsug commented 8 years ago
  1. done
  2. i can`t find any button property in pageTabBarItem. I only find buttonType property in pageTabBarItem. Where should i change it?
daniel-jonathan commented 8 years ago

Sorry my confusion, I thought you were asking about TabBar.

open class PageTabBarItem: FlatButton {
    open override func prepare() {
        super.prepare()
        pulseAnimation = .none
    }
}

The PageTabBarItem inherits from a FlatButton. So that allows you to do this:

pageTabBarItem.title = "Red"
pageTabBarItem.titleColor = Color.blueGrey.base
pageTabBarItem.image = Icon.cm.add

You can add this code to the PageTabBarController sample project to get the following:

screen shot 2016-11-01 at 11 33 32 pm

I am spending all month writing documentation, so apologies for the lack of documentation currently.

calvinsug commented 8 years ago

mmm, if i set image from pageTabBarItem, sometimes my image will cover all of tabBarItem, so the title will be hidden and i can`t change the size and the corner radius. like this screenshoot

i need to show the title like my app screenshoot

Moreover, i need to use button because i need to fill background color for my thumbUp & thumbDown image like this image

Can i apply the same thing to this TabBar? I really love the Highlight animation if i scroll my contentView, it follows exactly where i scroll (but sadly, in my current app, i can only use hidden/unhide the highlight bar)

daniel-jonathan commented 8 years ago

I am going to bed now, tomorrow I will be able to think about what can be done. I will reopen this issue and place it on the project board for tomorrow. I have another issue, #551 to fix in regards to the PageTabBar... so I can group this all together and come up with something nice.

calvinsug commented 8 years ago

nice, i will be waiting for your updates :)

daniel-jonathan commented 8 years ago

Didn't forget about this, I will be working on it today and throughout the weekend.

daniel-jonathan commented 7 years ago

I will be reworking this all tomorrow. Sorry for any delay.

calvinsug commented 7 years ago

Hey, forget about the last issue, how to implement this pageTabController without use AppDelegate.swift ?

I tried this but it causes crash in my app when i try to open that PageTabBarController

`import UIKit import Material

class MatchViewController: PageTabBarController { @IBOutlet weak var containerView: UIView!

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
}

open override func prepare() {
    super.prepare()

    self.viewControllers = [MatchDetailViewController(),ListPlayersViewController(),ChatViewController(),selectedIndex: 0]

    delegate = self
    preparePageTabBar()
}`
daniel-jonathan commented 7 years ago

At the current moment, storyboards are not well supported for this type of controller. When I rewrite this, I will see if I can make it happen. This is the next feature to rework, which I am hoping to tackle very soon.