Tag: uitapgesturerecognizer

UITapGestureRecognizer

Herkese merhaba! UIGestureRecognizer serisinin ilkyazısıolan UITapGestureRecognizer ilekarşınızdayız。 Uygulamadakullanıcınındokunuşlarınıtespit edenyapıyaUIGestureRenignor deniyor。 点击,捏,平移旋转gibi dokunma hareketlerini bunlaraözelUIGestureRecognizer altsınıflarıilegerçekleştirebiliyoruz。 BuyazımızdaTap konusunu elealcağız。 Vakit kaybetmedenbaşlayalım😉 UIGestureRecognizer Nedir吗? 手势识别器kulanıcınınparmak hareketleri ileetkileşimdeolan biryapıdır。 Farklıparmak hareketlerini特斯皮edip uygulamaiçibazıaksiyonlarıngerçekleşmesinisağlar。 UIGestureRecognizerKullanımAlanlarıNelerdir吗? Bir resmibüyütülmesinde,resmi ekranda tersçevirilmesinde,resiminüzerinetıkladığızamanbaşkabir resminaçılmasında…birçokalandakarşımızaçıkmaktadır。 UIGestureRecognizer AltSınıfları UITapGestureRecognizer: Kullanıcınınekrandayaptığıbasitdokunmalarıalgılar。 您可以在Instagramda bir照片上双击Double hareketi。 UIPinchGestureRecognizer: İkiparmaklayapılan,büyütmeveküçültmegibi hareketlerisağlayanyapıdır。 UIRotationGestureRecognizer: Döndürmehareketlerini tespit edenyapıdır。 UISwipeGestureRecognizer: Kaydırmahareketlerinialgılayanyapıdır。 Sayfalarıaşağı/yukarıkaydırmaörnekolarakgösterilebilir。 UIPanGestureRecognizer: Taşımahareketlerinisağlayanyapıdır。 UIScreenEdgePanGestureRecognizer: […]

UITableViewCell里带有手势识别器的UILabel块didSelectRowAtIndexPath

我在UITableViewCell使用了UITapGestureRecognizer一些UITapGestureRecognizer 。 GestureRecognizer运行良好。 但是当我点击标签时,我希望didSelectRowAtIndexPath:应该执行。 甚至只是indexPathForSelectedRow()方法应该给我选定的行。 设置cancelsTouchesInView = false不起作用! 这可能吗? 现在indexPathForSelectedRow()方法返回nil。 谢谢

我如何设置从代码的uiimageview的大小,以覆盖全屏在我的迅速的应用程序?

这实际上是这个问题的后续行动 – 当用户在我的UIImage在Swift中点击时,如何在全屏显示图像? 我设法添加一个tap监听器到我的uiimageview,但现在我想扩大它,当用户点击它。 我有这张照片的iboutlet: @IBOutlet weak var requestPhoto: UIImageView! 然后到目前为止监听器打印这个string: func tapHandler(sender: UITapGestureRecognizer) { if sender.state == .Ended { print("photo tapped") } } 现在,而不是打印string我想在全屏幕上显示的照片,但它可以在任何大小的iPhone屏幕上工作 – 有没有办法直接从代码做到这一点?

在tapGesture动作select器中包含协议function – iOS Swift

我有一个类(FilterBar.swift)和一个viewcontroller。 viewcontroller调用该类来填充一个具有图像列表的scrollView对象,每个图像都有一个tapGestureRecognizer添加到它,如下所示: let tapGesture = UITapGestureRecognizer( target: imgView, action: Selector("filterClicked:")); tapGesture.numberOfTapsRequired = 1; tapGesture.numberOfTouchesRequired = 1; imgView.addGestureRecognizer(tapGesture); 我也有一个在FilterBar中的函数,如下所示: @objc func filterClicked(sender: UITapGestureRecognizer) { print(sender.view?.superview?.description) print("sent from view: \(sender.view!.tag)"); } 当我尝试点击图片时出现以下错误: 2016-03-16 02:06:45.800 ImageFilter[71811:6885004] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView delegate.filterClicked:]: unrecognized selector sent to instance 0x7fc07951f010' 所以我想也许我需要一个协议,所以我在FilterBar中创build了一个协议如下: protocol FilterClickedDelegate { func […]

如何在Swift中知道发件人的标识符

我有一个UITableViewCell有两个UITapGestureRecognizers 。 cell.Username.tag = indexPath.row cell.SharedUser.tag = indexPath.row let tapGestureRecognizer2 = UITapGestureRecognizer(target:self, action:"GoToProfil:") let tapGestureRecognizer3 = UITapGestureRecognizer(target:self, action:"GoToProfil:") cell.Username.userInteractionEnabled = true cell.Username.addGestureRecognizer(tapGestureRecognizer2) cell.SharedUser.userInteractionEnabled = true cell.SharedUser.addGestureRecognizer(tapGestureRecognizer3) func GoToProfil (sender: AnyObject!) { self.performSegueWithIdentifier("GoToProfilSegue", sender: sender) } 我使用Segue来推送另一个UIViewController ,并且我重写PrepareSegue函数来发送对应于Sender标签的所需信息。 override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { let ProfilView = segue.destinationViewController as! Profil ProfilView.hidesBottomBarWhenPushed = true ProfilView.title = […]

iOS:两个手势,一个目标 – 行动

我正在实施消息应用程序复制消息function。 您可以双击或长按消息来复制它。 我怎么做? 我正在考虑添加两个手势识别器的视图,一个UITapGestureRecognizer ( numberOfTapsRequired设置为2 )和一个UILongPressGestureRecognizer 。 他们都会有相同的目标和行动。 然后,我想为他们每个人,我打电话requireGestureRecognizerToFail:传递另一个手势识别器。 我的想法是否正确? 有什么我失踪,还是有更好的方法来做到这一点?

如何知道在哪个tableview单元格被触摸了?

我在我的tableView自定义tableViewCells。 他们有两个或两个以上的ImageViews在单元格内,可以被触摸,然后他们将反弹并被选中。 但是由于单元格正在被重用,我怎么知道在哪个行中select了哪个ImageView? 我知道我可以得到indexPath.row,但我怎么知道2或3图像中的哪一个触发了函数给我indexPath? 希望你们明白我的意思。 这是我的自定义tableViewCell,tableView代码只是标准。 import UIKit class TwoPicsTableViewCell: UITableViewCell { @IBOutlet var containerView: UIView! @IBOutlet var votesButton: UIButton! @IBOutlet var commentsButton: UIButton! @IBOutlet var firstImage: bouncingRoundImageView! @IBOutlet var secondImage: bouncingRoundImageView! @IBOutlet var titleLabel: UILabel! @IBOutlet var descriptionLabel: UILabel! @IBOutlet var topUsernameLabel: UILabel! @IBOutlet var bottomUsernameLabel: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization […]

在使用UILongPressGestureRecognizer拖动另一个视图的同时在关键窗口上animation视图

我已经将UILongPressGestureRecognizer添加到视图中,并且在长按事件之后,用户可以拖动视图。 我已经在关键窗口添加了一个视图(需要导航和标签栏控制器上的自定义视图,这就是为什么需要添加它在关键窗口)使用下面的代码: // add the custom view on the key window. UIWindow *currentWindow = [UIApplication sharedApplication].keyWindow; [currentWindow addSubview:customView]; 现在,当我将第一个视图拖到(screenSize/2)点之外时,我希望customView从视图的右侧进行animation处理。 我试了下面的代码来呈现视图: // animate the customView view. [UIView animateWithDuration:0.50f animations:^{ customView.frame = CGRectMake(SCREEN_WIDTH – customViewWidth, 0, customViewWidth, SCREEN_HEIGHT); } completion:nil]; 但是这个观点并没有出现animation。 我什至尝试使用dispatch_async(dispatch_get_main_queue(),{}); 但仍然没有成功。 任何帮助将不胜感激。

UITapGestureRecognizer仅触发UIScrollView的开始区域

我有几个子视图添加到主视图控制器中的UIScrollView。 每个子视图的视图控制器都有自己的图标识别器。 问题是,只有在屏幕上的起始区域轻敲是公认的。 在滚动视图并敲击起始区域之后,敲击处理程序将不再被调用。 这个postUIButton在UIScrollView的不可见区域似乎是相关的,但其解决scheme的描述是不是真的很清楚我… 一个简单的报告项目可以在dropbox链接find 谢谢。

UICollectionView并使用Parse推送到detailViewController

我使用tapGesture方法将图像从UICollectionView包装到detailViewController viewController.h中,如下所示: #import <Parse/Parse.h> @interface CardsViewController : UIViewController <UICollectionViewDelegateFlowLayout> { NSMutableArray *allImages; NSArray *cardFileArray; } @property (weak, nonatomic) IBOutlet UICollectionView *imageCollection 和viewController.m如下 – (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } – (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return [cardFileArray count]; } – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"MyCell"; Cards *cell = (Cards *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier […]