獲取點擊事件的點相對於屏幕的位置spa
若是點擊事件是以下這個方法(將UIEvent當作參數傳回來)事件
-(void)expandButtonClicked:(id)sender withEvent:(UIEvent*)eventit
那麼點擊的位置相對於屏幕的座標就是:io
UITouch* touch = [[event touchesForView:btn] anyObject];event
CGPoint rootViewLocation = [touch locationInView:[FtAppDelegate shareAppDelegate].rootViewCtrl.view];方法
2.若是想知道一個view相對於屏幕或者另一個view 的座標,那麼能夠經過以下的方法獲得:touch
UIWindow * window=[[[UIApplication sharedApplication] delegate] window];
CGRect rect=[bView convertRect: bView.bounds toView:window];view