Coder Social home page Coder Social logo

Comments (11)

pNre avatar pNre commented on September 3, 2024 1

Got it, here:

self.navigationController?.view.addSubview(coachmark)

you are adding the coach mark as a subview of navigationController?.view.

And here:

coachmark.translatesAutoresizingMaskIntoConstraints = false
coachmark.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
coachmark.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
coachmark.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
coachmark.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true

you are installing layout constraints between the coach mark and your view controller view.

To fix your issue just set the constraints between coachmark and navigationController?.view by writing something like this:

coachmark.translatesAutoresizingMaskIntoConstraints = false
coachmark.leftAnchor.constraint(equalTo: navigationController!.view.leftAnchor).isActive = true
coachmark.topAnchor.constraint(equalTo: navigationController!.iew.topAnchor).isActive = true
coachmark.bottomAnchor.constraint(equalTo: navigationController!.view.bottomAnchor).isActive = true
coachmark.rightAnchor.constraint(equalTo: navigationController!.view.rightAnchor).isActive = true

from coachmarks.

pNre avatar pNre commented on September 3, 2024 1

Can you upload an example project having this issue?

from coachmarks.

pNre avatar pNre commented on September 3, 2024 1

Let me know if 56fce70 fixes the issue

from coachmarks.

pNre avatar pNre commented on September 3, 2024

Have you tried placing the coachmark view inside the view of your UINavigationController's topViewController?

from coachmarks.

fabriciomasiero avatar fabriciomasiero commented on September 3, 2024

Hi, im tried to present in topViewController and app dont crash anymore, awesome!

But im want to present coachmark in my NavigationBar too, like coachmarking my barbutton items...

Check this image on attach

My code:

self.navigationController?.topViewController?.view.addSubview(coachmark) coachmark.translatesAutoresizingMaskIntoConstraints = false coachmark.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true coachmark.topAnchor.constraint(equalTo: view.topAnchor).isActive = true coachmark.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true coachmark.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true

self.navigationItem.rightBarButtonItems = [self.btnBarSearch, self.btnBarFilter] coachmark.textLabel.textColor = .white coachmark.textLabel.text = "👋 this is a little example app showcasing some coach marks" coachmark.present(in: view, from: CGRect(x: self.btnBarFilter.buttonFrame().origin.x, y: 0, width: 40, height: 40), focusingOnElement: false)

Thanks bro

simulator screen shot 26 de jul de 2017 19 03 17

from coachmarks.

fabriciomasiero avatar fabriciomasiero commented on September 3, 2024

Ohh, its works very well!! Thank you!!

One more question here, I swear =D

Why are some white corners appearing? I already tried to change the background color and other things, but nothing stopped them from appearing. If I use in my navigationController.topView these same white corners do not appear!

simulator screen shot 31 de jul de 2017 15 18 08

Doesnt matter the position, look this

simulator screen shot 31 de jul de 2017 15 24 08

from coachmarks.

pNre avatar pNre commented on September 3, 2024

This is probably because the from: CGRect param you're passing to coachmark.present(in:from:focusingOnElement:) is too small.

Try adding some margin to it, try something like this:

coachmark.present(in: view, from: CGRect(x: self.btnBarFilter.buttonFrame().origin.x, y: 0, width: 40, height: 40).insetBy(dx: -5, dy: -5), focusingOnElement: false)

from coachmarks.

fabriciomasiero avatar fabriciomasiero commented on September 3, 2024

Doesnt matter my insetBy, the white walkers (AKA white corners) continues appearing

from coachmarks.

fabriciomasiero avatar fabriciomasiero commented on September 3, 2024

Yes, take a look

https://github.com/fabriciomasiero/CoachMarksExampleError

Please, use iPhone 6s, cause the present CGRect are with hand values

from coachmarks.

pNre avatar pNre commented on September 3, 2024

Ok, I guess that's a bug. I'll push a fix as soon as possible.

from coachmarks.

fabriciomasiero avatar fabriciomasiero commented on September 3, 2024

@pNre WORKS!!! Thanks bro!

from coachmarks.

Related Issues (3)

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.