uikit

touchesEnded:withEvent: from UIScrollView First Responder

淺唱寂寞╮ 提交于 2019-12-11 23:51:39
问题 I've made a UIScrollView the first responder. I need to maintain touch events to a -touchesEnded:withEvent: method on a view behind it. I've tried using the -nextResponder method and that failed. I've tried forwarding -touchesEnded:withEvent: to the view behind it and that fails. How do I get this to work? The UIScrollView wont work unless it is the first responder or gets events some other way. Thank you for any help. Shame Apple's documentation and APIs are terrible in areas. 回答1:

UIImageEffects: white image when Gaussian radius above 280, vImageBoxConvolve_ARGB8888 issue?

五迷三道 提交于 2019-12-11 21:22:31
问题 I'm using the Gaussian blur algorithm found in Apple's UIImageEffects example: CGFloat inputRadius = blurRadius * inputImageScale; if (inputRadius - 2. < __FLT_EPSILON__) inputRadius = 2.; uint32_t radius = floor((inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5) / 2); radius |= 1; // force radius to be odd so that the three box-blur methodology works. NSInteger tempBufferSize = vImageBoxConvolve_ARGB8888(inputBuffer, outputBuffer, NULL, 0, 0, radius, radius, NULL, kvImageGetTempBufferSize |

Why combined search bar and scope bar don't align correctly?

风流意气都作罢 提交于 2019-12-11 20:14:08
问题 First of all, quote form iOS User Interface Guidelines When a search bar is present, a scope bar can appear near it. The scope bar displays below the search bar, regardless of orientation, unless you use a search display controller in your code (for more information on the way this works, see UISearchDisplayController Class Reference). When you use a search display controller, the scope bar is displayed within the search bar to the right of the search field when the device is in landscape

if UILabel.text = [different Chinese Strings], memory leak?

喜欢而已 提交于 2019-12-11 17:57:01
问题 I was solving my app's memory leak problem, I narrowed the scope, and found out the "leak" (instruments didn't say leak, but memory went up) came from this method: - (void)loadDataSource { self.enLabel.text = self.dataSource.en; // English words self.cnLabel.text = self.dataSource.cn; // Chinese translation } The app is a flash cards app. Swipe to switch to next card. Tap to see answer(cnLabel.hidden = NO). It has only 2 CardView, when prepareing next card, cardView.dataSource will be set,

Resize CollectionView Cell during runtime without reloading

核能气质少年 提交于 2019-12-11 17:17:01
问题 For my app, it is necessary to resize a specific collectionview cell during runtime in order to fit the content size - just like .sizeToFit() but for collection view cells However, so far I only found solutions on how to dynamically size each collection view cell on startup. Is there any way to resize a collection view cell (in a smooth way) to fit the content size without reloading the whole collection view and losing all entered data? I am using AutoLayout and no storyboards - a programatic

SwiftUI go back programmatically from representable to View

主宰稳场 提交于 2019-12-11 17:09:21
问题 I'm trying to setup a qr reader within a new swift ui app. I can get load the UIKit qr reader view with this line NavigationLink(destination: QRCodeScan()){Text("Scan QR")} This is my ViewControllerRepresentable struct QRCodeScan: UIViewControllerRepresentable { func makeCoordinator() -> Coordinator { Coordinator(self) } func makeUIViewController(context: Context) -> ScannerViewController { let vc = ScannerViewController() vc.delegate = context.coordinator return vc } func

UIStackView Autolayout constraints

淺唱寂寞╮ 提交于 2019-12-11 17:04:33
问题 I am creating a UIStackView with two buttons + & -. In the landscape mode the stackview it looks like this with vertical axis. And in portrait mode it has horizontal axis like this: Problem: Each button +/- is 50 points high. In landscape, I set w=50 & h=140 for the stack view whereas for portrait I set w=200 & h=50. I set the spacing property of UIStackView of 20 points in landscape and 100 points in portrait. I use 'Vary for Traits' to define different constraints for the two modes as well

Upload images with Uikit 2 + Laravel

被刻印的时光 ゝ 提交于 2019-12-11 16:59:43
问题 I have the basic script Uikit 2 for upload images and it don't upload images on public images directory. Why? upload.blade.php <form id="upload" action="#" method="POST" enctype="multipart/form-data"> <div id="upload-drop" class="uk-placeholder"> <i class="uk-icon-upload uk-icon-large"></i>Select files<input id="upload-select" name="files[]" type="file" accept="image/*" multiple> </div> <div id="progressbar" class="uk-progress uk-hidden"> <div class="uk-progress-bar" style="width: 0%;">...<

iPhone SDK: IBAction

▼魔方 西西 提交于 2019-12-11 16:37:57
问题 I have a situation where I'd like a button to respond to two different IBAction methods. Is there a way that I can force a particular method first? When I look at the buttons connections in IB they are in the correct order, but they consistently perform in the opposite order. 回答1: I don't believe so, but why not just call one action from the other? 回答2: Deleting all the connections in IB then reconnecting in the order I require seemed to work. 来源: https://stackoverflow.com/questions/632309

Any way to prevent UIActionSheet from being dismissed when user clicks a button in it?

*爱你&永不变心* 提交于 2019-12-11 16:16:33
问题 I added a UIProgressView to my UIActionSheet to indicate the download progress. So I do not want my UIActionSheet to be dismissed when user click the download button in it. But is there a way to do that ? Right now I implement didDismissWithButtonIndex delegate method to show UIActionSheet again after it was dismissed. But I was hoping there is a better way. 回答1: UIActionSheet is a modal view, which means that it blocks UI completely. Since blocking UI is considered a bad practice, preventing