screen-positioning

get UIButton inside an UIScrollView absolute screen location

本小妞迷上赌 提交于 2019-12-19 18:23:48
问题 It may be a dumb question, but I can't find an answer to this ... I have an UIScrollView and inside a number of UIButtons. When I press a button, I want to know the screen location of the button. If I use button.frame it gives me the position inside UIScrollView, which is normal. How can I find x and y relative to screen of the button pressed? Thanks in advance. 回答1: Your objection was right- instead, use - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view from UIView, like [button

get UIButton inside an UIScrollView absolute screen location

此生再无相见时 提交于 2019-12-19 18:23:21
问题 It may be a dumb question, but I can't find an answer to this ... I have an UIScrollView and inside a number of UIButtons. When I press a button, I want to know the screen location of the button. If I use button.frame it gives me the position inside UIScrollView, which is normal. How can I find x and y relative to screen of the button pressed? Thanks in advance. 回答1: Your objection was right- instead, use - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view from UIView, like [button

How to center a WPF app on screen?

风格不统一 提交于 2019-12-02 14:59:49
I want to center my WPF app on startup on the primary screen. I know I have to set myWindow.Left and myWindow.Top, but where do I get the values? I found System.Windows.Forms.Screen.PrimaryScreen , which is apparently not WPF. Is there a WPF alternative that gives me the screen resolution or something like that? Put this in your window constructor WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; .NET FrameworkSupported in: 4, 3.5, 3.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1 xaml WindowStartupLocation="CenterScreen" You can still use the Screen class from

get UIButton inside an UIScrollView absolute screen location

吃可爱长大的小学妹 提交于 2019-12-01 17:15:57
It may be a dumb question, but I can't find an answer to this ... I have an UIScrollView and inside a number of UIButtons. When I press a button, I want to know the screen location of the button. If I use button.frame it gives me the position inside UIScrollView, which is normal. How can I find x and y relative to screen of the button pressed? Thanks in advance. Rob Lourens Your objection was right- instead, use - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view from UIView, like [button.superview convertPoint:button.frame.origin toView:nil]; Not tested, but I believe that should