I have a requirement that when user clicks on a button to make a call, I need to send a request to backend to do something.
I used Link view to do that, the code is quite simple like this:
Link(destination: URL(string: "tel:110")!, label: {
Text("Call 110")
})
I tried to add modifier of onTapGesture to Text, and this makes the Link not work.
And I also tried to add modifier of onOpenUrl to Link, but it doesn't callback either.
I guess there's a solution to use Text instead of Link, and add modifier onTapGesture to call UIApplication.shared.open(theUrl) and then make the remote request.
But I still want to know if there's a way to know the Link is clicked.
Thanks a lot
Related
I want to go from one view to another with the click of a button. Like if I press Log In, it goes to the "Home" view.
I tried to use NavigationLink, but it needs a NavigationView, which I don't want to do because it messes with the format of the app on macOS. What is an alternative to NavigationLink to get from one view to another?
Using SwiftUI and running into an issue with the keyboard. I want to use the .deicmalPad but I can't dismiss it since it has no "return" button.
Found a workaround: use UIApplication.shared.windows[0].endEditing(true) on a button. (Tried using it on the viewController for the app but it broke NavigationLinks)
Now I want to add the "Next", "Previous" and "Submit" strip above the keyboard, like in this picture: http://brainwashinc.com/wp-content/uploads/2017/07/Simulator-Screen-Shot-Jul-28-2017-9.07.42-AM.png
can't find SwiftUI documentation for this feature, only finding incompatable UIKit solutions involving inputAccessoryView and it's items.
Ultimatly want to use the "Submit" button's event to use UIApplication.shared.windows[0].endEditing(true) and finally get the keyboard to go away.
Thanks in advance
i've been using datepicker in many of my projects, but this one project, i've got a problem with it.
the prev/next buttons don't act like it suppose to do. when i clicked it, it redirects to the default page. for example, here is the url where i implemented datepicker
$('input#_date').datepicker();
project.dev/index.html?q=123a21#/home
then, when i click prev/next button, it redirects me to default page which is
project.dev/
i have no idea why this one acts like this. has anyone any idea on how to fix this?
EDITED:
i found out source of the problem but still can't figure out a way to solve it.
everytime i clicked next/prev button on datepicker, it always redirects to default router which is $.sammy.get(''). i found out that prev/next button on datepicker is actually an <a> tag without href attribute.
i managed to solve it eventhough (i still have no idea why it happens) by preventing the default event.
$('input#_date).datepicker({
//options
}).focus(function() {
$('.ui-datepicker-next, .ui-datepicker-prev').on('click', function(e) {
e.preventDefault();
});
});
I'm working on a events board app. Events are displayed in columns at the height matching the start time and pack into the space if there is more then one overlapping. Each event is a view and I want to have a div next to the view that shows and hides on hover.
I know how to bind to mouseEnter and mouseLeave to show and hide part of the template but I want to show something adjacent to my view/template not within it.
I've already got some computed properties on the view to place the event with the correct height and width so I don't want to add the popover inside the view.
Here is something to mess with http://jsbin.com/osoner/1/edit
Seems like something simple but I want to make sure I'm doing things the Ember way.
After messing a little with your provided jsbin, here the results.
Basically what I've done was adding a new popup css declaration wich do position the popup so that it appears outside the parent view, and also moved the {{#if...}} helper into the originating view.
If you want to go more fancy, checkout this jsfiddle wich uses the twitter boostrap popover.
Hope it helps.
I am trying to detect events on table cells. I have found that I can receive the events when I use the {{action}} helper, but not when I define an event method on the view. Here is an example:
http://jsfiddle.net/9nWNQ/1/
Clicking the text "No action" should log a message, but it doesn't.
You might ask why I don't just use the action? The problem is that I want to detect multiple events and according to https://github.com/emberjs/ember.js/issues/569 I need to use a view.
I don't know why, but if you define your view as a by setting tagName: 'tr', it seems to work. http://jsfiddle.net/Sly7/ACzrY/#base
Perhaps your code produce an invalid html page, and the the click event is not triggered
Update: http://jsfiddle.net/Sly7/pX8ww/
I've replace the view tag with 'td' to behave more like the example