uikit

Hide and show scrollview with animation

℡╲_俬逩灬. 提交于 2020-01-05 06:41:33
问题 In my app I have a scrollview and when I press a button it is hidden when I press again it shows up. I use scrollview.hidden = YES (or NO) to do it. But I want to do it with an animation. For example, it may disappear from the bottom of the screen by moving and shows up with the same way. How can I do that? edit: [UIView beginAnimations:@"myAnimation" context:nil]; CGRect Frame = bottomScroller.frame; if(Frame.origin.y == 380){ Frame.origin.y = 460; }else{ Frame.origin.y = 380; }

MacOS: Add a text overlay to an image in Swift

非 Y 不嫁゛ 提交于 2020-01-05 04:36:09
问题 I've written a small extension for UIImage, which adds a text to an image: extension UIImage { func addTextToImage(textToAdd: String) -> UIImage { let textColor = UIColor.white let textFont = UIFont(name: "Snell Roundhand", size: 40)! let scale = UIScreen.main.scale UIGraphicsBeginImageContextWithOptions(self.size, false, scale) let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = NSTextAlignment.center var textFontAttributes = [ NSAttributedString.Key.font: textFont,

How do I save state with CALayers?

帅比萌擦擦* 提交于 2020-01-05 04:05:29
问题 I have a simple iphone application that paints blocks using a subclass of CALayer and am trying to find the best way to save state or persist the currently created layers. I tried using Brad Larson's answer from this previous question on storing custom objects in the NSUserDefaults, which worked for persisting my subclass of CALayer, but not it's basic state like geometry and background color, so they were there but did not render on relaunch. I made my declared instance variables conform to

How do I save state with CALayers?

こ雲淡風輕ζ 提交于 2020-01-05 04:05:09
问题 I have a simple iphone application that paints blocks using a subclass of CALayer and am trying to find the best way to save state or persist the currently created layers. I tried using Brad Larson's answer from this previous question on storing custom objects in the NSUserDefaults, which worked for persisting my subclass of CALayer, but not it's basic state like geometry and background color, so they were there but did not render on relaunch. I made my declared instance variables conform to

UILabel text duplicates in PDF when containing a certain character

帅比萌擦擦* 提交于 2020-01-05 03:43:09
问题 I'm generating a PDF something like: UIGraphicsBeginPDFContextToFile layer.render(in: context) UIGraphicsEndPDFContext Yesterday, I found a fix to make all text vector-based (basically this answer https://stackoverflow.com/a/9056861/897465). That worked really well, text is vectors and searchable, etc. Except for one irritating thing. Everytime a UILabel contains the character "Å", the text is kind of duplicated in the PDF, like the image below. Probably there are other characters as well the

Custom UITableViewCells disappearing when scrolling

风格不统一 提交于 2020-01-04 14:09:25
问题 I am making an app in which I have MKMapView with some MKAnnotations on it. I also have a list (a UITableView) with more info about places represented by those annotations, in which my problem occurs. I use my own UITableViewCell subclass, which has 3 UILabels: the default textLabel for name of the place, addressLabel and phoneNumberLabel. I have to consider situation where texts in those labels are too big to be displayed in one line and resize the UILabels accordingly. I also have to

How can I make a UINavigationController's UINavigationBar invisible or at least change color

一个人想着一个人 提交于 2020-01-04 09:08:09
问题 I have a UINavigationController that is Linked to a ViewController that is set as RootController. I have enabled the UINavigationBar and put 3 UIViews each with a UIButton inside. Ideally I would like to make the UINavigationBar completely invisible, but I would also settle for setting the color to the background color of my ViewController. I am working in swift and I have tried things like self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default) self

XCode: Programmatically enable a symbolic breakpoint?

流过昼夜 提交于 2020-01-03 17:06:19
问题 Is there a way to programmatically enable a breakpoint? Normally I'd use a breakpoint condition, but I need to use a symbolic breakpoint. Specifically, something is changing the contentOffset of my UIScrollView between a call to scrollToIndexPath and a call to reloadData . I'd like to enable the symbolic breakpoint only after the call to scrollToIndexPath . 回答1: Jim Ingham's answer works on a x86 system. For an iOS device I was able to use the method described in this answer to

XCode: Programmatically enable a symbolic breakpoint?

烂漫一生 提交于 2020-01-03 17:05:54
问题 Is there a way to programmatically enable a breakpoint? Normally I'd use a breakpoint condition, but I need to use a symbolic breakpoint. Specifically, something is changing the contentOffset of my UIScrollView between a call to scrollToIndexPath and a call to reloadData . I'd like to enable the symbolic breakpoint only after the call to scrollToIndexPath . 回答1: Jim Ingham's answer works on a x86 system. For an iOS device I was able to use the method described in this answer to

Compiling Qt for iOS (UIKit lighthouse)

拜拜、爱过 提交于 2020-01-03 14:05:23
问题 I've been trying to compile Qt for iOS, but I've been having some crazy problems that noone else seems to be having (at least according to what I read in the past day). I followed the instructions from this article:article url I cloned a the latest Qt 4.8 from git: $ git clone git://gitorious.org/qt/qt.git I made the qt-lighthouse-ios-simulator folder, cd to it. I ran the long line of code from the article: $ ../qt/configure -qpa -xplatform qpa/macx-iphonesimulator-g++ -arch i386 -developer