Tag: 触摸

iOS – 水平滑动项目

我有一张照片,比如长方形的纸。 我想把它放在屏幕的中心,当用户用手指向左或向右滑动时(比方说左边),那张纸应该向左(用手指),并且从右边开始应该是新的纸上有一些新的信息。 我希望我的描述不会混淆。 我想这个function应该很容易做iOS SDK,我只是不知道该用什么… 谢谢你的帮助 ;)

如何获得iOS的触摸大小?

我明白, 这个回应清楚地表明,这是不可能的,没有私人函数调用。 因此,根据苹果的条款,这种方法不能用于App Store应用程序。 但是,一些应用程序似乎已经使用这个函数调用: 倒数第二的实际手掌拒绝没有预先定义的拒绝区域,像在笔记本高清 Virtuoso的压力敏感度,他们称之为“TrueVelocity 2” GarageBand也用于压力敏感度 显然,尽pipe苹果受到限制,但这种方法已经在App Store应用程序中广泛使用。 tl; dr什么是iOS上的私人函数调用来获取触摸大小?

如何防止iOS上的同一UIButton的多个事件?

我想要防止在同一个UIButton上连续多次点击。 我尝试enabled和exclusiveTouch属性,但它没有奏效。 如: -(IBAction) buttonClick:(id)sender{ button.enabled = false; [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionAllowAnimatedContent animations:^{ // code to execute } completion:^(BOOL finished){ // code to execute }]; button.enabled = true; }

使用coregraphics,通过触摸擦除和删除UIImageVIew中的图像

我的问题和这里提到的一样。 我也在我的应用程序中使用两个图像,我需要的是通过触摸删除顶部图像。 然后通过触摸删除(如果需要)删除的部分。 我正在使用以下代码来擦除顶部图像。 这种方法也有问题。 这是图像很大,我使用Aspect Fit内容模式来正确显示它们。 当我触摸屏幕时,它在angular落而不是触摸的地方。 我认为接触点计算需要一些修复。 任何帮助将不胜感激。 第二个问题是如何通过触摸来删除已擦除的部分? UIGraphicsBeginImageContext(self.imgTop.image.size); [self.imgTop.image drawInRect:CGRectMake(0, 0, self.imgTop.image.size.width, self.imgTop.image.size.height)]; self.frame.size.width, self.frame.size.height)]; CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); GContextSetLineWidth(UIGraphicsGetCurrentContext(), pinSize); CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0, 0, 0, 1.0); CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy); CGContextBeginPath(UIGraphicsGetCurrentContext()); CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y); CGContextStrokePath(UIGraphicsGetCurrentContext()); self.imgTop.contentMode = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

iOS 5(safari)在“position:fixed”div上的HTML touch事件

我有一个位置:在滚动的网页固定div。 起初事件起作用,但当页面滚动,而固定的div保持原位时,其“触摸”区域似乎改变(似乎滚动 – 除了另一个div顶部,或根据页面布局… )。 最后,如果滚动过多,则不会再收到触摸事件。 有时候,底层div接收事件。 这里是示例: <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"> <meta name="apple-mobile-web-app-capable" content="yes" /> <style> #fixed { position: fixed; width:200px; height:200px; z-index:1; background: rgba(100,0,0,0.5); } #scrolling { display: block; position: absolute; top: 100px; left: 100px; width:200px; height:999px; background: rgba(0,100,0,1); } </style> </head> <body> <div id="fixed" […]

包括触摸事件clientX / Y滚动或不?

我试图从触摸事件(如touchstart )获取触摸坐标相对于浏览器的视口 。 我试图从clientX / Y属性获取它们,但实际上都返回包括滚动的值。 这是违反规范,因为它说clientX / Y应该返回坐标而不滚动。 我尝试添加/删除元视口标签 – 没有成功。 我每天晚上在iPhone和Fennec的iOS 4.3上进行testing,两者均通过滚动返回值。 我做错了什么? 谢谢

Xcode 7,Obj-C,“空传递给需要一个非空参数的被调用者”

在Xcode 7中,我得到这个警告: Null passed to a callee that requires a non-null argument ..从这个零的NSMutableArray的初始化… sectionTitles = [[NSMutableArray alloc] initWithObjects:nil]; 我发现我应该使用removeAllObjects 。 [sectionTitles removeAllObjects]; 但是,这不允许我评估sectionTitles.count == 0 。 我没有尝试iniWithObjects sectionTitles == nil ,但是除非我使用iniWithObjects我不能以后添加对象。 我需要将数组设置为零或零,当我刷新我的数据源时,当没有logging。 我似乎无法使用addObject添加项目,除非我已经使用initWithObjects 。

检查touchend是否在拖动之后

我有一些代码,它改变了表的类。 在手机上,有时桌子太宽了,用户会拖动/滚动查看内容。 但是,当他们触摸并拖动表格时,会触发每次拖动的触发。 我如何testing,看是否触摸拖动的结果? 我尝试跟踪dragstart和dragend,但我无法得到这个工作,这似乎是一个不雅的方法。 有什么我可以添加到下面,基本上确定,“这个touchend到达拖动结束? $("#resultTable").on("touchend","#resultTable td",function(){ $(this).toggleClass('stay'); }); 在此先感谢您的帮助。 PS – 使用最新的jQuery,虽然经常点击的作品,但与touchend相比非常缓慢。

为了方便不能使用#define

我可能犯了一些语法错误,但我不明白为什么我的代码不工作: 在.m文件的顶部,我写道: #define kCountry "Country"; 在这种情况下,我得到了来自xCode的红色警告 – 预期] 然后在函数体中: floatCountries = 74,2; [[NSUserDefaults standardUserDefaults]setFloat:floatCountries forKey:kCountry]; float test= [[NSUserDefaults standardUserDefaults]floatForKey:kCountry]; NSLog(@"%f", test); 在那一个 – 预期的expression。 这听起来有点愚蠢,但我想简化我的代码,并使用它,请帮助我! 🙂

为什么UIViewController touchesBegan,touchesMoved&touchesEnded只有在两个触摸的第一个开始,移动或结束时被调用?

我遇到了一个问题,通过UIViewController的touchesBegan / Moved / Ended方法处理多个触摸。 我也看到了在cocos2d应用程序(使用ccTouchesBegan / Moved / Ended)相同的行为,所以我认为这个问题可以应用于iOS中的所有触摸处理。 我已经把我在下面使用的代码,然后是我看到的结果。 所有的方法都在UIViewController子类上实现。 – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touches Began"); [self logTouchesFor: event]; [super touchesEnded: touches withEvent: event]; } – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touches Moved"); [self logTouchesFor: event]; [super touchesEnded: touches withEvent: event]; } – (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touches Ended"); [self […]