我正在尝试检查屏幕上特定区域是否发生了点击.我已经设置了TapGestureRecognizer,这是我现在拥有的代码:
func handleTap(tap: UITapGestureRecognizer) {
var point = tap.locationInView(self.view)
println("tapped")
if (tap.state == UIGestureRecognizerState.Ended)
{
if (CGRectContainsPoint(self.Region.frame, point)) {
println("touch")
var y = kbHeight - textYoutube.center.y
youTextConst.constant += y
}
}
}
Run Code Online (Sandbox Code Playgroud)
该应用程序识别了水龙头,但未识别特定区域的水龙头,代码有什么问题?
UPDATE
我不知道它是否重要,但Region是TextView
我在我的应用中使用了Google+和Facebook.我的问题是它们都需要appDelegate中的OpenURL方法.
对于Facebook登录:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
Run Code Online (Sandbox Code Playgroud)
对于Google+登录信息:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return GPPURLHandler.handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
}
Run Code Online (Sandbox Code Playgroud)
如何在同一个应用程序中同时使用google +和facebook?