Code Monkey home page Code Monkey logo

Comments (9)

tambadiya avatar tambadiya commented on August 22, 2024 2

I am ios developer..
i want to use folding tabbar in only one view controller so its possible for use it..?

from foldingtabbar.ios.

scoobydont avatar scoobydont commented on August 22, 2024

I was stuck on this for a bit but this is how I got it to work:

First, in your main storyboard, make a new UITabBarController. Next, add a new Cocoa Touch Class file to your project and make sure it is a subclass of YALFoldingTabBarController. Whatever you end up naming it, go back to the main storyboard and set the class name of the UITabBarController you made earlier to the name you gave to the Cocoa Touch Class file you created.

Next, in the new class file you made in the viewDidLoad function, you would set up all the same things you see in the AppDelegate file in the example provided by Yalantis minus this statement:

YALFoldingTabBarController *tabBarController = (YALFoldingTabBarController *) self.window.rootViewController;

Then, everytime you see tabBarController used, you would simple use "super" instead. This worked for me using swift so the SampleFoldingTabBarController.swift file (which is the custom Cocoa Touch Class I made) looks something like this:

import UIKit
import FoldingTabBar

class SampleFoldingTabBarController: YALFoldingTabBarController {

let tabItem1: YALTabBarItem = YALTabBarItem(itemImage: UIImage(named:"something", leftItemImage: UIImage(named:"somethingElse")

override func viewDidLoad() {

    super.viewDidLoad()

    super.leftBarItems = [tabItem1]

    super.centerButtonImage = UIImage(named: "centerImage")

    //so on and so forth

}

from foldingtabbar.ios.

serejahh avatar serejahh commented on August 22, 2024

@MarceloPrado Have you tried the solution above? Do you need some help?

from foldingtabbar.ios.

alexrodrigues avatar alexrodrigues commented on August 22, 2024

It works!!! Thanks

from foldingtabbar.ios.

LiveRock avatar LiveRock commented on August 22, 2024

It works! But I also want to handle touches on extra tabBarItems in the items page. So far, no successes after 2 days...

`import Foundation
import UIKit
import ARSLineProgress
import FoldingTabBar

class ViewControllerHome: UIViewController,UITextFieldDelegate,YALTabBarInteracting,YALTabBarViewDelegate {

var delegate: YALTabBarViewDelegate?

override func viewDidLoad() {
    super.viewDidLoad()
    print("Home VC called")
    // Do any additional setup after loading the view.


  //  tabBarController = (YALFoldingTabBarController *) self.window.rootViewController

}

// MARK: YALTabBarInteracting protocol
@objc func extraLeftItemDidPressInTabBarView(tabBar: YALFoldingTabBar) {
    print("extraLeftItemDidPressed")

}

@objc func extraRightItemDidPressed(sender: AnyObject) {
    print("extraRightItemDidPressed")

}

}`

from foldingtabbar.ios.

LiveRock avatar LiveRock commented on August 22, 2024

Ok, i got it.

from foldingtabbar.ios.

hungri-yeti avatar hungri-yeti commented on August 22, 2024

@LiveRock Can you give some guidance how you did this?

from foldingtabbar.ios.

LiveRock avatar LiveRock commented on August 22, 2024

First, you need to conform to the protocol YALTabBarInteracting
Then you need to implement extraLeftItemDidPress and extraRightItemDidPress like this:

// MARK: YALTabBarInteracting protocol
@objc func extraLeftItemDidPress() {
print("extraLeftItemDidPress")
}

I couldn't get it to work initially because I did not implement it properly like:
@objc func extraLeftItemDidPress(sender : AnyObject!) {
print("extraLeftItemDidPress")
}

from foldingtabbar.ios.

ilhammalik avatar ilhammalik commented on August 22, 2024

i want implement for swift, some people can help me?

from foldingtabbar.ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.