cocoa-touch

Detect when app killed by user in background state iOS

我的未来我决定 提交于 2020-07-30 04:13:05
问题 I am working in a chat application where I need to show user status (offline/online). When my app is in foreground and background then I need to show user as online (managing by VoIP). But when the user kill the app then it should go to offline. I have to maintain a flag to show offline which I am managing in delegate function applicationWillTerminate but this function only called when app is in foreground state and user kill it by pressing double tap home button and swipe up. This function

iphone touch shape or raw data

可紊 提交于 2020-07-05 15:57:20
问题 Anyone know if it is yet possible to detect the touch shape? Maybe through getting the raw touchscreen data? I found this question/answer here: How to get raw touchscreen data? That mentions GSEvent, but it is quite old. I'd like to try to get a rough calculation of the pressure of the touch by its shape/area, but of course UITouch only gives a calculated point. 回答1: Yes, raw touch data is contained in the GSEventRecord object, particularly what you are looking for is the pathMajorRadius

iOS Keyboard Colour Changes - keyboardAppearance dark color doesn't stick

浪子不回头ぞ 提交于 2020-06-27 07:31:14
问题 In our app, we set the keyboardAppearance to dark. This produces a black keyboard, as expected. However, if the keyboard is showing, and we press the home button, and then go back into the app, the keyboard turns white, as shown. Any ideas why? 回答1: It may have todo with the fact that the keyboard is a global object. There's only ever one keyboard in memory at any given time. Also, the OS will automatically change the keyboard color based on the background. Therefore, your setting is probably

iOS 13 UIPanGestureRecognizer behave differently from iOS 12

a 夏天 提交于 2020-06-26 08:46:43
问题 I have a custom scroll view that works well before iOS 13 that uses UIPanGestureRecognizer: _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; _panRecognizer.delegate = self; - (void)handlePan:(UIGestureRecognizer *)gestureRecognizer { UIPanGestureRecognizer* pgr = (UIPanGestureRecognizer*)gestureRecognizer; if (pgr.state == UIGestureRecognizerStateChanged) { // do something } } Now it didn't work well with iOS 13. The handlePan function does

iOS 13 UIPanGestureRecognizer behave differently from iOS 12

早过忘川 提交于 2020-06-26 08:45:43
问题 I have a custom scroll view that works well before iOS 13 that uses UIPanGestureRecognizer: _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; _panRecognizer.delegate = self; - (void)handlePan:(UIGestureRecognizer *)gestureRecognizer { UIPanGestureRecognizer* pgr = (UIPanGestureRecognizer*)gestureRecognizer; if (pgr.state == UIGestureRecognizerStateChanged) { // do something } } Now it didn't work well with iOS 13. The handlePan function does