Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTCellConfiguration not working. #38

Open
KuldeepAIP opened this issue Aug 19, 2020 · 2 comments
Open

FTCellConfiguration not working. #38

KuldeepAIP opened this issue Aug 19, 2020 · 2 comments

Comments

@KuldeepAIP
Copy link

I want to change text color and font. For that i have tried below code but it's not working.

let cellConfiguration = FTCellConfiguration()
cellConfiguration.textColor = .black
cellConfiguration.textFont = UIFont.init(name: Fonts.AvenirRegular, size: 14.0)!
cellConfiguration.textAlignment = .left
        
var cellConfigurationArray: [FTCellConfiguration]?
cellConfigurationArray?.append(cellConfiguration)
        
FTPopOverMenu.showForSender(sender: sender, with: activeEmployeeOption, menuImageArray: [], cellConfigurationArray: cellConfigurationArray, done: { (selectedIndex) -> () in
    print(selectedIndex)
})

No crash with above code but color & font not working.

OR

FTPopOverMenu.showForSender(sender: sender, with: activeEmployeeOption, menuImageArray: [], cellConfigurationArray: [cellConfiguration], done: { (selectedIndex) -> () in
     print(selectedIndex)
})

If i use above line of code then app getting crash with Fatal error.

Fatal error: Index out of range: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.2.25.8/swift/stdlib/public/core/ContiguousArrayBuffer.swift, line 444

i also tried this: #37 (comment)

but it returns me an error like : 'FTConfiguration' initializer is inaccessible due to 'internal' protection level

i am using pod 'FTPopOverMenu_Swift', '~> 0.2.0'.

@lukeirvin
Copy link

Did you ever get this to work? I'm seeing the same issue.

@KuldeepAIP
Copy link
Author

KuldeepAIP commented Sep 23, 2020

@lukeirvin , yes it worked. you can try this.

Remove pod and import FTPopOverMenu_Swift folder in your project manually.

Then you need to define configuration

func configWithMenuStyle() -> FTConfiguration {
    let config = FTConfiguration()
    config.backgoundTintColor = UIColor.white
    config.borderColor = UIColor.lightGray
    config.globalShadow = true
    config.shadowAlpha = 0.05
    config.menuWidth = 110
    config.menuSeparatorColor = UIColor.clear
    config.menuRowHeight = 40
    config.cornerRadius = 2
    config.textColor = Colors.bottomTabNormalColor
    config.textAlignment = .left
    config.textFont = UIFont.init(name: Fonts.AvenirDemi, size: 16.0)!
    config.borderColor = UIColor.clear
    config.borderWidth = 0.0
    return config
}

You can use this code from where you want to show it.

@IBAction func btnMoreTapped(_ sender: UIButton) {
    FTPopOverMenu.showForSender(sender: sender, with: ["Settings", "Delete"], menuImageArray: [], popOverPosition: .automatic, config: self.configWithMenuStyle(), done: { (selectedIndex) in
        if selectedIndex == 0 {
            print("First")
        } else if selectedIndex == 1 {
            print("Second")
        }
    }, cancel: {
        print("cancel")
    })
}

Try this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants