cocoa-touch

iOS 13 UIPanGestureRecognizer behave differently from iOS 12

泪湿孤枕 提交于 2020-06-26 08:44:48
问题 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

How do I present a view controller over current context with a custom transition?

不羁的心 提交于 2020-06-24 08:29:22
问题 I am running into a problem with view controller containment and wanting to present view controllers "over current context" with a custom presentation/animation. I have a root view controller that has two child view controllers that can be added and removed as children to the root. When these child view controllers present a view controller I want the presentation to be over current context so that when the child that is presenting is removed from the view heirarchy and deallocated the

UIButton pass-through tap-and-scroll gesture to UIScrollView

风格不统一 提交于 2020-06-12 08:59:11
问题 I have a horizontal paginated UIScrollView with a UIButton partially covering the scroll view. Like this: UIView | |- UIScrollView | |- UIButton I want to make the UIButton to not trigger on tap-scroll-and-relase-above-the-button (I want the UIScrollView to scroll instead). I want the button to only respond to tap-and-release-without-moving . Can this easy and quickly done? Or should I subclass the UIButton and override -touchesBegan: , etc., to manually pass the touches to the scrollView

Resize CGSize to the maximum with keeping the aspect-ratio

房东的猫 提交于 2020-06-12 04:10:27
问题 I have a CGSize objects that I need to send to my server. The maximum size I can send to the server is 900*900 (900 width/900 height). There are some objects that are larger the 900*900 and I want to write a function that resizes them to the maximum (as I already say, the maximum is 900*900) but to keep the aspect ratio. For example: if I have an object that is 1,000px width and 1,000px height I want the function to return a 900*900 object. If I have an object that is 1920px width and 1080px

Objective-C Blocks in C

蓝咒 提交于 2020-06-10 04:02:33
问题 While reading through the blocks conceptual overview in Apple Docs, I saw the following statement: Although blocks are available to pure C and C++, a block is also always an Objective-C object. How is this possible? I mean an Objective-C object available in pure C. I'm getting confused. 回答1: How is this possible? I mean an Objective-C object available in pure C. Matt Gallagher wrote an article that nicely explains how blocks work. In a nutshell, blocks are defined as structs that meet the

Objective-C Blocks in C

限于喜欢 提交于 2020-06-10 04:01:08
问题 While reading through the blocks conceptual overview in Apple Docs, I saw the following statement: Although blocks are available to pure C and C++, a block is also always an Objective-C object. How is this possible? I mean an Objective-C object available in pure C. I'm getting confused. 回答1: How is this possible? I mean an Objective-C object available in pure C. Matt Gallagher wrote an article that nicely explains how blocks work. In a nutshell, blocks are defined as structs that meet the

Control spacing around custom text attributes in NSLayoutManager

痴心易碎 提交于 2020-06-09 12:50:47
问题 I’ve got a custom NSLayoutManager subclass I’m using to draw pill-shaped tokens. I draw these tokens for substrings with a custom attribute ( TokenAttribute ). I can draw no problem. However, I need to add a little bit of “padding” around the ranges with my TokenAttribute (so that the round rectangle background of the token won’t intersect with the text). In the above image, I’m drawing my token’s background with an orange colour, but I want extra padding around 469 so the background isn’t

iPhone GPS Development - Tips + Tricks [closed]

天大地大妈咪最大 提交于 2020-06-06 08:38:25
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I'm looking for some feedback, blog links, etc that offer some tips and tricks for iPhone GPS development. I've read and understand

Disable multiple taps on uitableviewcell

岁酱吖の 提交于 2020-05-29 06:13:12
问题 I have a uitableview that implements a popover (PopoverView) when a cell is tapped and then the popover will dismiss on any other tap on the screen. The issue is that if a user would to double tap or tap repeatedly on the cell, it will cause multiple instances of popoverviews to display and then the application will crash.. I am looking for a way to either disable double tapping on the cell and/or the UITableView in general OR is there a way to delay touches on a UITableViewCell any ideas? I

How do you keep the cancel button in the search bar enabled when the keyboard is dismissed?

孤街浪徒 提交于 2020-05-25 03:56:50
问题 I'm trying to achieve the same effect as Apple's Contacts app (left screenshot). The cancel button in UISearchBar is enabled even when the keyboard is dismissed. My app behaves differently (right screenshot). The cancel button automatically becomes disabled when the keyboard is dismissed. The user is forced to tap the cancel button one time to enable it and then another time to actually trigger the dismissal. This is not good user experience. How would I always keep the cancel button enabled