以下代码可以进一步简化吗?
var onLogoutTap = new TapGestureRecognizer();
onLogoutTap.Tapped += (object sender, EventArgs e) => {
MessagingCenter.Send(this, "Logout");
};
logoutImage.GestureRecognizers.Add(onLogoutTap);
.Tapped...
部分能否以某种方式直接传递到TapGestureRecognizer()
?
答案 0 :(得分:3)
是。 var swiper = new Swiper('.swiper-container', {
slidesPerView: 'auto',
freeMode: true,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
});
有多个constructors,您可以在其中传递回调。
TapGestureRecognizer