aromajoin / material-showcase-ios Goto Github PK
View Code? Open in Web Editor NEW✨ An elegant way to guide your beloved users in iOS apps - Material Showcase.
Home Page: https://aromajoin.com/
License: Other
✨ An elegant way to guide your beloved users in iOS apps - Material Showcase.
Home Page: https://aromajoin.com/
License: Other
no option to set backgroundViewType
showcase.backgroundViewType = .full is not available.
Delegate methods not working while View inherit the delegates.
I have create a new class name as tempViewClass which inherit UIView, In that tempViewClass i have implemented the showcase. i called that tempViewClass in HomeViewController to show particular view. then i called the function to show that showcase. Everything showing perfect. but the delegate method is not working.. i have set showcase.delegate = self and implemented delegate methods in both classes.
Note: For testing purpose i have implemented delegate in both classes. implementing in individual classes also not working. Delegate is not working in your sample project also
Is there any support for UICollectionView?
showcase.delegate = self
MaterialShowcase delegate method is not being called.
Hello, i am getting errors when compiling material showcase in XCode 10. Can you please update the pod with the support of swift 4.2
Hi, you have a little bug. Please check place where you calculate frame for secondaryLabel on iPad.
In this place you set radius
if UIDevice.current.userInterfaceIdiom == .pad { radius = 300.0 } else { radius = containerView.frame.width }
and i think you forgot about it there:
secondaryLabel.frame = CGRect(x: xPosition, y: yPosition, width: containerView.frame.width - xPosition, height: LABEL_DEFAULT_HEIGHT)
how do i make this pod compatible with a legacy app in swift 2.3
Hi,
When I am trying to install this library using pod install it is giving me below error:
[!] Unable to find a specification for `MaterialShowcase`
I did a search on cocoapods, it is not showing any results
Am I missing anything? Can you please guide me on how to install the library
Thanks,
Pranav
have any feature to perform any action by clicking on target view in material showcase library like MaterialTapTargetPrompt-iOS
setTargetView(barButtonItem: barItem) does not work if the barButtonItem is created with an image or text. There is no "view" attribute to attach as a target.
Hi,
I can't able to set the custom font in primary and secondary text.
Also the text is not truncate to second line.
Hi, it seems like 0.5.2 doesn't have the ability to full screen the circle in the version available in cocoapods.
I want to customise the size of background circle as it going to be done by the property "showcase.backgroundViewType = .full" in documentation. But when I try to access this property I got issue as: Value of type 'MaterialShowcase' has no member 'backgroundViewType'.
Please tell any alternative option to customise the background view size
Trying to get the tutorial to load the tabBar, but for whatever reason it isn't working. Any ideas?
func showShowcase() {
let showcase = MaterialShowcase()
showcase.setTargetView(tabBar: self.tabBarController!.tabBar, itemIndex: 1) // always required to set targetView
showcase.primaryText = "Home"
showcase.secondaryText = "Tap here for stats on your overall portfolio performance. All values are based on current prices and the weighted average accounting method."
// Background
showcase.backgroundPromptColor = UIColor.fromHex(hexString: "38A0BA")
showcase.backgroundPromptColorAlpha = 1.0
// Target
showcase.targetTintColor = UIColor.black
showcase.targetHolderRadius = 44
showcase.targetHolderColor = UIColor.white
// Text
showcase.primaryTextColor = UIColor.white
showcase.secondaryTextColor = UIColor.white
showcase.primaryTextSize = 28
showcase.secondaryTextSize = 16
showcase.primaryTextFont = UIFont.systemFont(ofSize: 28, weight: .heavy)
showcase.secondaryTextFont = UIFont.systemFont(ofSize: 16, weight: .light)
// Animation
showcase.aniComeInDuration = 0.5 // unit: second
showcase.aniGoOutDuration = 0.5 // unit: second
showcase.aniRippleScale = 1.5
showcase.aniRippleColor = UIColor.white
showcase.aniRippleAlpha = 0.2
showcase.show(completion: {
// You can save showcase state here
// Later you can check and do not show it again
})
}
`
private func addTarget(at center: CGPoint) {
targetCopyView = targetView.snapshotView(afterScreenUpdates: true)
if shouldSetTintColor {
targetCopyView.setTintColor(targetTintColor, recursive: true)
if targetCopyView is UIButton {
let button = targetView as! UIButton
let buttonCopy = targetCopyView as! UIButton
buttonCopy.setImage(button.image(for: .normal)?.withRenderingMode(.alwaysTemplate), for: .normal)
buttonCopy.setTitleColor(targetTintColor, for: .normal)
buttonCopy.isEnabled = true
} else if targetCopyView is UIImageView {
let imageView = targetView as! UIImageView
let imageViewCopy = targetCopyView as! UIImageView
imageViewCopy.image = imageView.image?.withRenderingMode(.alwaysTemplate)
} else if let imageViewCopy = targetCopyView.subviews.first as? UIImageView,
let labelCopy = targetCopyView.subviews.last as? UILabel {
let imageView = targetView.subviews.first as! UIImageView
imageViewCopy.image = imageView.image?.withRenderingMode(.alwaysTemplate)
labelCopy.textColor = targetTintColor
} else if let label = targetCopyView as? UILabel {
label.textColor = targetTintColor
}
}
let width = targetCopyView.frame.width
let height = targetCopyView.frame.height
targetCopyView.frame = CGRect(x: 0, y: 0, width: width, height: height)
targetCopyView.center = center
targetCopyView.translatesAutoresizingMaskIntoConstraints = true
addSubview(targetCopyView)
}
targetCopyView = targetView.snapshotView(afterScreenUpdates: true)
targetCopyView returns an UIReplicantView and cannot determine which kind of class should it enter in the if-else statement
Strangely, I can't seem to set the targetHolderRadius
value - tells me the property is not found.
targetTintColor
and targetHolderColor
isn't a problem, but just can't seem to see targetHolderRadius
.
Objective C project, and installed material-showcase-ios via cocoapods.
I'll keep seeing what I can find, but pretty odd.
It would be better if the view can expand based on the amount of the secondary text; a the moment it seems that the max lines are fixed to 3.
There are many issues related to calling show()
function in ViewController viewDidLoad()
where ui components are not fully placed and shown correctly.
Hey everyone,
I'm trying to use the material showcase library with an image button as the target.
However, when my app starts, the button is replaced with a plain color blue version of it, hiding all the details of the image... I tried to change the color parameters to clear or even comment some of them, but it didn't fix it. The image is still replaced by a plain color version of itself...
Is it the way the library is intended to work?
Thanks for your help!
I mean to Objective-C, for using in React Native apps.
i have a legacy project in swift 2.3,how do i make this compatible with it?
When I use a non-transparent icon as a button image, the button is displayed as painted with the tintColor. Could the .withRenderingMode(.alwaysTemplate) be an option?
Hello @quangctkm9207,
Just checked on master repo, delegate callbacks are not working anymore. App is not able to get dismiss callback on the delegates.
extension ViewController: MaterialShowcaseDelegate {
@objc func showCaseWillDismiss(showcase: MaterialShowcase) {
print("Showcase \(showcase.primaryText) will dismiss.")
}
@objc func showCaseDidDismiss(showcase: MaterialShowcase) {
print("Showcase \(showcase.primaryText) dimissed.")
print("tutorialStep = \(tutorialStep)")
}
I guess there has bene some breaking changes in last two releases of the library. But seems to working for 0.6.0 & previous.
Thanks for such an handy library. I tried using this library which works like charm but when I add it to custom tableView, I am not able to get the actual effect of Showcase in Rectangle. (Though its working fine if defined the radius , but then it shows in TargetHolderView in Circle)
Below is the code snippet :
class func showShowcaseForTableSection(tableview : UITableView, viewController : UIViewController, showcasetype : ShowCaseType, section: Int, row: Int){
let showcase = MaterialShowcase()
showcase.setTargetView(tableView: tableview, section: section, row: row)
showcase.primaryText = showcasetype.primaryText
showcase.secondaryText = ""
// showcase.targetHolderRadius = 80 // Just need to ignore this, as I was rectangle targetHolder
// showcase.targetHolderColor = UIColor.white
showcase.shouldSetTintColor = false // Tried using this as well as
showcase.backgroundPromptColor = UIColor.darkHotPink
showcase.isTapRecognizerForTagretView = false
showcase.delegate = viewController as? MaterialShowcaseDelegate
showcase.show(completion: { DataManager.sharedInstance.tutorialStepsCounter += 1 })
}
Can you help me out where I am making the mistake or I doubt, if this gonna work with custom tableViewCells too.
Hi,
I have one question How can i check event click for example when showcase show first tab item after user click on it I want to show next tab item as show case. How can I do this?
Another question is how can I change default background color of circle?
Thanks,
vafa
Hey,
great library! :)
I am having troubles with the secondaryText (primaryText might be affected is well). If the string is too long, the text goes off screen instead of line-breaking to a second line.
Cheers
i am using JJFloatingActionButton library for my button and i want to set this button as a target of showcase but after running my app showcase target is somewhere else.
this my code
defining button:
actionButton = JJFloatingActionButton()
view.addSubview(actionButton)
actionButton.translatesAutoresizingMaskIntoConstraints = false
actionButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16).isActive = true
actionButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16).isActive = true
and the picture is my app after running, the target should be green button at the right of screen!
How can i detect when user tapped right to targetView? Just for now, i can handle only when showcase view will or did close by tapping anywhere. It's bad practice, because we force user to do second tap to same place.
@quangctkm9207 Just got some custom requirement instead of developing my own showcase library, I prefer to have some workaround for adding action based button in the showcase.
i.e Next, Previous & Skip options below the Secondary Label in the instruction view.
Hello. I have 2 time to show showCase, first is ok. when click to dismiss, in showCaseDidDismiss function i take new show case. But it auto dismiss when showed. Can you take a look:
INIT (called on viewdidload)
func initShowcase() {
showCase.backgroundPromptColor = .darkGray
showCase.shouldSetTintColor = false
showCase.targetHolderColor = UIColor.clear
showCase.delegate = self
}
FIRST ( called in get data function)
@objc func getVideoData() {
NWUtil.shared.getData(url: "...", params: nil, success: { (response) in
...
if !UserDefaults.standard.bool(forKey: INTRO_MAPVIEW){
self.showCase.setTargetView(barButtonItem: self.bttMap)
self.showCase.primaryText = "Bản đồ"
self.showCase.secondaryText = "Bạn có thể xem tất cả camera trên bản đồ."
self.showCase.show(completion: {
UserDefaults.standard.set(true, forKey: INTRO_MAPVIEW)
UserDefaults.standard.synchronize()
})
}
}
...
}) { (error) in
....
}
}
SECOND
func showCaseDidDismiss(showcase: MaterialShowcase, didTapTarget: Bool) {
print("Showcase \(showcase.primaryText) dimissed.")
if !UserDefaults.standard.bool(forKey: INTRO_GROUPVIEW){
self.showCase.setTargetView(barButtonItem: self.bttGroup)
self.showCase.primaryText = "Nhóm camera"
self.showCase.secondaryText = "Bạn có thể xem tất cả camera theo danh sách nhóm."
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.showCase.show(completion: {
UserDefaults.standard.set(true, forKey: INTRO_GROUPVIEW)
UserDefaults.standard.synchronize()
})
}
}
}
Hi,
Few issue around the library :
@quangctkm9207 Not sure, whether its the required behaviour of the library or some issues around it.
Hey I use swift 4 and iOS 11.4
showcase.show(completion: { _ in // You can save showcase state here })
have problems
Cannot convert value of type '(_) -> ()' to expected argument type '(() -> Void)?'
Who is the Error?
I want to display showcase for button so I code for that but it shows in misplaced from assigned target view.
I have set the target view for '+' symbol button in the following screen shot.
First Screenshot
But showcase shows in away from target view, I have provide the screenshot for the issue.
Second Screenshot
And Here I provide the code what I am tried.
`override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
showButtonShowcase(newInspectionBtn)
}
//MARK: - display showcase
func showButtonShowcase(_ sender: UIButton) {
let showcase = MaterialShowcase()
showcase.setTargetView(view: sender)
showcase.backgroundViewType = .circle
showcase.targetTintColor = UIColor.clear
showcase.targetHolderColor = UIColor.clear
showcase.primaryText = "Add Inspection"
showcase.secondaryText = "Click here to go into details"
showcase.shouldSetTintColor = false // It should be set to false when button uses image.
showcase.isTapRecognizerForTagretView = true
showcase.show(completion: {
print("==== completion Action 1.1 ====")
// You can save showcase state here
})
}`
Please help and find me what wrong I do this code and how to fix the issue.
Is there any plan to add Carthage support?
Hi,
Thanks for your cool component,
but there is a bug on iPad: the instructions labels (both primary and secondary) are drawn out of the circle.
Issues :
When I set an auto layout to UIButton, the background image of the UIButton will be displayed on the top left corner of the screen instead of that correct original position.
Please give me suggestion for that
HI, i've a project in which i want to introduce show case but as in introduction it shows that we need to have code on swift. So how can i implement this library in my objective c project. Thanks in advance
A crash:
library version:0.1.4
iOS 9.3.5
logs:
Crashed: com.apple.main-thread
0 MaterialShowcase 0x10405e0 _T016MaterialShowcaseAAC14layoutSubviewsyyF + 6752
1 MaterialShowcase 0x103ebfc _T016MaterialShowcaseAAC14layoutSubviewsyyF + 124
2 MaterialShowcase 0x104084c _T016MaterialShowcaseAAC14layoutSubviewsyyFTo + 28
3 UIKit 0x26202a73 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 714
4 QuartzCore 0x2429abcd -[CALayer layoutSublayers] + 128
5 QuartzCore 0x24296375 CA::Layer::layout_if_needed(CA::Transaction*) + 348
6 QuartzCore 0x24296209 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
7 QuartzCore 0x242956d1 CA::Context::commit_transaction(CA::Transaction*) + 368
8 QuartzCore 0x242953a5 CA::Transaction::commit() + 520
9 QuartzCore 0x2428eb2b CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 138
10 CoreFoundation 0x21c4d6c9 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 20
11 CoreFoundation 0x21c4b9cd __CFRunLoopDoObservers + 280
12 CoreFoundation 0x21c4bdff __CFRunLoopRun + 958
13 CoreFoundation 0x21b9b229 CFRunLoopRunSpecific + 520
14 CoreFoundation 0x21b9b015 CFRunLoopRunInMode + 108
15 GraphicsServices 0x2318bac9 GSEventRunModal + 160
16 UIKit 0x2626f189 UIApplicationMain + 144
17 PrintOSMobile 0xe78af main (main.m:14)
18 libdispatch.dylib 0x21843873 (Missing)
Hi,
If my target view inside the custom view which is added in the UIViewController's view then it's target view drawn outside the custom view. It's working fine in case of navigation item.
Hi,
Is there a way to move the Y position of the instructionView? Now it's fixed whatever the targetHolderRadius is. Which is not practical since the holder circle can overlap the text when its radius is big.
Thanks
Hey I have a while implementing this pod, and recently this problem starts to show up.
First I think that was a problem of mine, that maybe I delete my variable or image where was attached, at end few times works and rest no.
Always launching an error (Fatal error: Unexpectedly found nil while unwrapping an Optional value) in:
func initViews() {
let center = calculateCenter(at: targetView, to: containerView)
addTargetRipple(at: center)
addTargetHolder(at: center)
addTarget(at: center)
addInstructionView(at: center)
instructionView.layoutIfNeeded()
addBackground()
// Add gesture recognizer for both container and its subview
addGestureRecognizer(tapGestureRecoganizer())
// Disable subview interaction to let users click to general view only
for subView in subviews {
subView.isUserInteractionEnabled = false
}
}
I need to clean build for succeed build. But after that i take this error
fatal error: lipo: can't open input file: /Users/gokmen/Library/Developer/Xcode/DerivedData/DeMarke-foivturhjbqmezgplcmvaycxgbrx/Build/Products/Debug-iphoneos/DeMarke.app/Frameworks/MaterialShowcase.framework/MaterialShowcase (No such file or directory)
Merging extracted architectures: arm64
fatal error: lipo: can't open input file: /Users/gokmen/Library/Developer/Xcode/DerivedData/DeMarke-foivturhjbqmezgplcmvaycxgbrx/Build/Products/Debug-iphoneos/DeMarke.app/Frameworks/MaterialShowcase.framework/MaterialShowcase-arm64 (No such file or directory)
rm: /Users/gokmen/Library/Developer/Xcode/DerivedData/DeMarke-foivturhjbqmezgplcmvaycxgbrx/Build/Products/Debug-iphoneos/DeMarke.app/Frameworks/MaterialShowcase.framework/MaterialShowcase-arm64: No such file or directory
Replacing original executable with thinned version
rm: /Users/gokmen/Library/Developer/Xcode/DerivedData/DeMarke-foivturhjbqmezgplcmvaycxgbrx/Build/Products/Debug-iphoneos/DeMarke.app/Frameworks/MaterialShowcase.framework/MaterialShowcase: No such file or directory
mv: rename /Users/gokmen/Library/Developer/Xcode/DerivedData/DeMarke-foivturhjbqmezgplcmvaycxgbrx/Build/Products/Debug-iphoneos/DeMarke.app/Frameworks/MaterialShowcase.framework/MaterialShowcase-merged to /Users/gokmen/Library/Developer/Xcode/DerivedData/DeMarke-foivturhjbqmezgplcmvaycxgbrx/Build/Products/Debug-iphoneos/DeMarke.app/Frameworks/MaterialShowcase.framework/MaterialShowcase: No such file or directory
I want to display showcase at first time the view was loaded only, after I don't want to Display that how to save the status of showcase and control it for not showing next times in following completion.
showcase.show(completion: { // You can save showcase state here // Later you can check and do not show it again })
Thanks for such an handy library. I tried using this library which works like charm but i have a problem with it,
this is kinda wierd but sometimes (it doesn't follow a certain pattern)sometimes when the user see's the showcase the text is kinda overlapped check the pic bellow.
i dont know why this happens :
it's like the showcase is showing two of the showcase at the same time but whit diffrent positions
Hi @quangctkm9207,
This lib will be better if the sequence case has skip button/text with style define like setDismissText, setDismiss Button radius,...
=> In case user can break/skip tutorial sequences :)
Thanks,
Cong
My button bar have white color, after set target tint to red. It not working.
func initShowcase() {
showCase.backgroundPromptColor = .darkGray
showCase.targetTintColor = .red
}
self.showCase.setTargetView(barButtonItem: self.bttMap) // always required to set targetView
self.showCase.primaryText = "Bản đồ"
self.showCase.secondaryText = "Bạn có thể xem tất cả camera trên bản đồ."
self.showCase.show(completion: {
// You can save showcase state here
// Later you can check and do not show it again
})
Weird line appear in view
look at image please help .
Code:
let showcaseTrafficBleat = MaterialShowcase() showcaseTrafficBleat.setTargetView(tabBar: tabBar, itemIndex: 1) showcaseTrafficBleat.primaryText = NSLocalizedString("Traffic Bleat", comment: "") showcaseTrafficBleat.secondaryText = NSLocalizedString("Your chance to become an active participant in making our roads a safer place, for all of us.", comment: "") showcaseTrafficBleat.backgroundPromptColor = UIColor.black showcaseTrafficBleat.targetHolderRadius = 50 showcaseTrafficBleat.primaryTextAlignment = .justified showcaseTrafficBleat.secondaryTextAlignment = .justified showcaseTrafficBleat.targetHolderColor = UIColor.clear showcaseTrafficBleat.targetTintColor = UIColor.clear showcaseTrafficBleat.show(completion: nil)
I have crash problem in
`/ MARK: - UIView extension utility
extension UIView{
// Create a view's copy
func copyView() -> AnyObject{
return NSKeyedUnarchiver.unarchiveObject(with: NSKeyedArchiver.archivedData(withRootObject: self))! as AnyObject
}
// Transform a view's shape into circle
func asCircle(){
self.layer.cornerRadius = self.frame.width / 2;
self.layer.masksToBounds = true
}
}`
can you help me?
First of all I would like to thank you for this library!
Secondly, I would like to ask if supporting a UIBarButtonItem as the target view is supported, or is planned. Thank you!
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.