ytakzk / hokusai Goto Github PK
View Code? Open in Web Editor NEWA Swift library to provide a bouncy action sheet
License: MIT License
A Swift library to provide a bouncy action sheet
License: MIT License
line 351
// Add a cancel button
self.addCancelButton("Done") ///here
// Decide the menu size
should be
self.addCancelButton(cancelButtonTitle)
I've encountered some compiler error after upgrading to Swift 4.
Xcode Version 9.1
Pods/Hokusai/Classes/Hokusai.swift:186:65: Argument of '#selector' refers to instance method 'tick' that is not exposed to Objective-C
Pods/Hokusai/Classes/Hokusai.swift:285:64: Argument of '#selector' refers to instance method 'onOrientationChange' that is not exposed to Objective-C
/Pods/Hokusai/Classes/Hokusai.swift:353:36: Argument of '#selector' refers to instance method 'buttonTapped' that is not exposed to Objective-C
And counting...How can fix this?
Thanks in advance
Hi, I tried this simple code:
let hokusai = Hokusai()
// Add a button with a closure
hokusai.addButton("Button 1") {
println("Rikyu")
}
// Add a button with a selector
hokusai.addButton("Button 2", target: self, selector: Selector("button2Pressed"))
// Set a font name. AvenirNext-DemiBold is the default. (Optional)
hokusai.fontName = "Verdana-Bold"
// Select a color scheme. Just below you can see the dafault sets of schemes. (Optional)
hokusai.colorScheme = HOKColorScheme.Karasu
hokusai.colors = HOKColors(
backGroundColor: UIColor.blackColor(),
buttonColor: UIColor.purpleColor(),
cancelButtonColor: UIColor.grayColor(),
fontColor: UIColor.whiteColor()
)
// Show Hokusai
hokusai.show()
// Selector for button 2
func button2Pressed() {
println("Oribe")
}
// Change a title for cancel button. Default is Cancel. (Optional)
hokusai.cancelButtonTitle = "Done"
// Add a callback for cancel button (Optional)
hokusai.cancelButtonAction = {
println("canceled")
}
but i have this error, do you had never seen it before?
HOKColors' cannot be constructed because it has no accessible: initializers
the cancel button's color always equal default button
even I use the custom UIColor Or change the preset colors parameter.
There is an issue to the rotation Portrait -> Landscape
To recreate the problem:
Launch the app in portrait. do not rotate
Open the menu when the device is still vertically
Rotate the device
My fix
menuView. shapeLayer. frame = frame menuView.
menuView. shapeLayer. bounds. origin = origin menuView. frame.
menuView. updatePath () //ADD THIS LINE
menuView. shapeLayer. layoutIfNeeded ()
menuView. layoutIfNeeded ()
I don't know if it's the right time to call menuView.updatePath()
Perhaps it would be better to call it somewhere else or change something else
Hello, I have just used your library. It looks very convenient and great. But I found out, there is an issue, if I rotate a phone, menu will not adjust properly.
Swift Compiler Error after updating to Swift:
"Argument of '#selector' refers to instance method 'tick' that is not exposed to Objective-C"
Based on my research, adding @objc
would expose these instance methods to Objective-C and I see that in the Hokusai.swift file of your latest Hokusai version (0.4.0) on Github you have those @objc
attributes. However, when I install the latest Hokusai pod via Cocoapods, I do not see these attributes in the Hokusai file.
Not sure why the Hokusai.swift pulled from Cocoapods differs from the Hokusai.swift here in the repo (the 6 missing @objc attributes seem to be the only difference). For example, in the Hokusai.swift file of the latest master branch, it correctly shows the attribute for example:
@objc func tick(_ displayLink: CADisplayLink)
But in the Hokusai.swift file in my Xcode project, I do not see this @objc attribute, even though I installed the latest Hokusai (0.4.0) (via pod Hokusai
in my Podfile).
@ytakzk
I have added Hokusai.show on a button Action and the problem that i have observed is that a cancel button gets added when ever I click on my Added button.Please suggest if this is an issue or implementation fault.
I some how managed to resolve the issue too but I did that by manipulating a line of code in your class Hokusai.swift. Where i commented the code as follow:
// Add a cancel button
// self.addCancelButton(cancelButtonTitle)
Hello!
Love your pod, super easy to implement! Only issue i'm having is that it's slightly hard to customize!
What I am trying to do is make it so that instead of animating up from the bottom of the screen, it animates down form the top of the screen. I've been trying for a couple days now on and off, but if this is something that would be an easy tweak, please let me know!
Thanks!
Hello how can I add a title text and description for better user experience and also to match the original action sheet from Apple. :)
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.