younatics / yndropdownmenu Goto Github PK
View Code? Open in Web Editor NEW✨ Awesome Dropdown menu for iOS with Swift 5.0
Home Page: https://www.cocoacontrols.com/controls/yndropdownmenu
License: MIT License
✨ Awesome Dropdown menu for iOS with Swift 5.0
Home Page: https://www.cocoacontrols.com/controls/yndropdownmenu
License: MIT License
Looking for setting the menu background color as clear Color. It is showing white color only.
Tried with the demo project as well.
view.setBackgroundColor(color: UIColor.clear)
As an objective looking to be have one dropdown button on text field. On opening it will show search filter form within dropdown view.
I found the deployment target is 10.3, but the readme is 8.0
I have installed the most recent version of YNDropDownMenu however i got this error
"/Users/x/Documents/IOS development/Kallos/Pods/YNDropDownMenu/YNDropDownMenu/YNDropDownMenu.swift:583:43: 'init(colorLiteralRed:green:blue:alpha:)' is unavailable: This initializer is only meant to be used by color literals"
I need change the top menu backgroundColor to clear, you said use YNDropDownButton in issue15, but YNDropDownButton is not public, I can't use it by Carthage.
I need this:
// filterView.snp.makeConstraints { (make) in
// make.top.equalTo(64)
// make.left.right.equalTo(view)
// make.height.equalTo(38)
// }
I'm using SnapKit, the label of menu displays on top offset about half of height. pls check it.
I am wanting to implement a table view, which is populated by an API, in the drop down. I added a table to the XIB file and created another XIB file for the table cell.
Primary View Controller:
class EcardSingleCategoryViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
var ecards = Content
let imageCache = NSCache<NSString,AnyObject>()
@IBOutlet weak var ecardCollection: UICollectionView!
var name = ""
var id = ""
override func viewDidLoad() {
super.viewDidLoad()
let ZBdropDownViews = Bundle.main.loadNibNamed("EcardCategories", owner: nil, options: nil) as? [UIView]
let view = YNDropDownMenu(frame:CGRect(x: 0, y: 64, width: UIScreen.main.bounds.size.width, height: 64), dropDownViews: ZBdropDownViews!, dropDownViewTitles: ["Choose Category"])
self.view.addSubview(view)
}
In the initViews() function, I get the following error ... for the "categoryTable.register( ... " code
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
I'm not sure how I would go about calling the cell's XIB file and populate the data.
Drop Down code:
class EcardCategoriesMenu: YNDropDownView {
@IBOutlet var categoryTable: UITableView!
var categories = [CategoryItem]()
override init(frame: CGRect) {
super.init(frame: frame)
self.initViews()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initViews()
}
func initViews() {
// categoryTable.register(UINib(nibName: "EcardCategoriesCell", bundle: nil), forCellReuseIdentifier: "EcardCategoriesCell")
categoryTable.delegate = self
categoryTable.dataSource = self
DispatchQueue.main.async {
let jsonUrlString = "https://*****/category"
guard let url = URL(string: jsonUrlString) else { return }
URLSession.shared.dataTask(with: url) { (data, response, err) in
guard let data = data else { return }
if err == nil {
do {
let decoder = JSONDecoder()
let ecardcategory = try decoder.decode(Category.self, from: data)
self.categories = ecardcategory.category
self.categories.sort(by: {$0.title < $1.title})
} catch let err {
print("Err", err)
}
DispatchQueue.main.async {
print(self.categories.count)
self.categoryTable.reloadData()
}
}
}.resume()
}
}
}
extension EcardCategoriesMenu: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return categories.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "EcardCategoriesCell", for: indexPath) as? EcardCategoriesCell else { return UITableViewCell() }
cell.categoryName.text = ("\(categories[indexPath.row].title)")
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Ecard", bundle: nil)
let desVC = mainStoryboard.instantiateViewController(withIdentifier: "EcardSingleCategoryViewController") as! EcardSingleCategoryViewController
desVC.id = String(categories[indexPath.row].id)
let navigationController = UIApplication.shared.keyWindow?.rootViewController as! UINavigationController
navigationController.pushViewController(desVC, animated: true)
}
}
Cell Code:
class EcardCategoriesCell: UITableViewCell {
@IBOutlet weak var categoryName: UILabel!
}
Any help sorting through this would be great.
In Swift4, a declaration within an NSObject-derived class will no longer infer @objc.
https://github.com/apple/swift-evolution/blob/master/proposals/0160-objc-inference.md
There is no example code that does this and neither is there documentation. Is it supported or is this framework purely front-end?
what should we do if we want to achieve same layout vertically ?
open func setImageWhen(normal: UIImage?, selectedTintColor: UIColor, disabledTintColor: UIColor)
didn't setup buttonImagesArray
i want to layout a tableView in YNDropDownView, it's unsupported?
Is there a way to have multiple titles on the YNDropDownMenu that can be scrolled horizontally?
For example, instead of having only Apple, Banana, Kiwi and Pear, I could add 5 more and have them displayed by scrolling horizontally.
You need override override func layoutSubviews()
I am going to send pull requests for you.
When I used your component with clear background color I have noticed stange effect.
dropDownView to bland with menu, but for second show menu this problem doesn't reproduce.
I think you have refused change position, but In initViews() you forget this remove.
I am making the pull request.
the bottom line x position should be 0. when change menuview x positon, the bottom line x position is error. sorry my poor english.
From what I can tell, by adding a YNDropDownMenu to my view, it creates three subviews for the items, the view to be toggled, and a background faded view.
Everything works great if the user does not change their screen orientation, but if they do, the menu and it's three created views do not update their dimensions.
I've tried manually adding constraints myself, but they only target one of the three views, and I have no way to access the other two views created to add constraints to them as well. Help?
Could Carthage support be added?
how can i change the views height, when i drawed views in xib, i override frame, this will cause constraints conflict
Hi,
Very nice dropdown :-)
Im trying to change the YNDropDownMenu backgroundColor to UIColor.white.withAlphaComponent(0.0), I can't find where to do this, any suggestions?
Thanks
Bennie
I placed YNDropDownMenu inside a UIView, it seems to be hid when DropDownViews show up.
Any way to solve this?
Structures:
Code:
@IBOutlet weak var pageMenu: UIView!
let menuView = YNDropDownMenu(frame: CGRect(x: 0, y: 0, width: self.pageMenu.frame.width, height: self.pageMenu.frame.height), dropDownViews: _customerDropViews, dropDownViewTitles: ["Menu1", "Menu2", "Menu3"])
let FFA409 = UIColor.init(red: 255/255, green: 164/255, blue: 9/255, alpha: 1.0)
menuView.setImageWhen(normal: UIImage(named: "arrow_nor"), selected: UIImage(named: "arrow_sel"), disabled: UIImage(named: "arrow_dim"))
menuView.setImageWhen(normal: UIImage(named: "arrow_nor"), selectedTintColor: FFA409, disabledTintColor: FFA409)
menuView.setImageWhens(normal: [UIImage(named: "arrow_nor"),UIImage(named: "arrow_nor"),UIImage(named: "arrow_nor")], selectedTintColorRGB: "FFA409", disabledTintColorRGB: "D3D3D3")
menuView.setLabelColorWhen(normal: .gray, selected: menuFontColor, disabled: .black)
menuView.setLabelFontWhen(normal: .systemFont(ofSize: 14), selected: .systemFont(ofSize: 14), disabled: .systemFont(ofSize: 14))
menuView.bottomLine.isHidden = false
menuView.bottomLine.backgroundColor = UIColor.init(red: 224/255, green: 224/255, blue: 224/255, alpha: 1)
pageMenu.addSubview(menuView)
It is showing "Unable to find a specification for YNDropDownMenu
" while installing pod.
My project's deployment target is 9.0.
What is the issue?
fatal: unable to access 'https://github.com/younatics/YNDropDownMenu.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
The dropDownMenu won't dismiss when Tabbar item clicked,what can I do
Hi ,
I can not change background color nor the text color no matter what I do the always become white color..
IOS 10.3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.