uikit

UIViewController's didReceiveMemoryWarning in ARC environment

情到浓时终转凉″ 提交于 2019-12-23 07:03:47
问题 I'm evaluating the switch to ARC (automatic reference counting) and the refactoring to apply to my code. Among the things I have to figure out, there is this: what should I do in didReceiveMemoryWarning if the explicit release of objects is not allowed by ARC? Currently, I use that method to release objects belonging to my controller and that are easily retrievable via lazy getters: - (void)didReceiveMemoryWarning { [_foo release]; _foo = nil; [super didReceiveMemoryWarning]; } and the

Memory Management with NSDecimalNumber: How to avoid memory problems in tight loops?

只愿长相守 提交于 2019-12-23 06:57:27
问题 I have a tight loop that iterates about 500 times. In every iteration, it will create a few NSDecimalNumber objects to do some arithmetics. Example - this code snippet is in the for loop. the -decimalNumberByAdding: method creates a new NSDecimalNumber instance and autoreleases it. resultDecimalNumber = [resultDecimalNumber decimalNumberByAdding:anotherDecimalNumber]; So let me get that right: If the loop is huge, I collect thousands of NSDecimalNumber objects which wait for the whole loop to

How to convert (.doc,.xls,.ppt) to pdf using objective c? [closed]

删除回忆录丶 提交于 2019-12-23 06:22:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I can able to implement the annotation on pdf file and export it. But in the case of doc,xls and ppt i couldn't able to apply the annotation using objective c ? So i had plan to convert the (.doc,.xls,.ppt) files to pdf format. Using UIKit or Quartz framework possible to implement ? 回答1: You can do it with

Loading many UIImages from disk blocks main thread

混江龙づ霸主 提交于 2019-12-23 06:21:07
问题 I have a group of local UIImage s that I need to load and present in successive order when their respective cell is tapped. For example, I have 20 images of a hot dog that combine to form an animation. When the user taps the hot dog cell, the cell's UIImageView should animate the images. I know how to use UIImageView 's animationImages to achieve the animation. My problem is that retrieving all of these images from disk takes ~1.5 seconds and blocks the main thread. I could instantiate a

Auto-rotate the default application image according to current landscape mode

心已入冬 提交于 2019-12-23 05:47:10
问题 Is it possible to auto-rotate the default application image according to current landscape mode? I can rotate my views just fine according to information from the UIDevice class, but I would like the whole application to be in the correct landscape mode from the start. 回答1: This isn't possible at the moment. If your app is designed to be in landscape mode you can obviously rotate your Default image but there is no way to show a different image or rotate it based on the orientation when your

UISplitView: Why are there multiple DetailController-Instances? (new one on each segue)

▼魔方 西西 提交于 2019-12-23 05:09:05
问题 I've noticed that in a Master-Detail UISplitView iPhone app, I dont have one single instance of my DetailController and getting that reused by setting new content, instead it seems that on each segue/everytime I navigate to the Detail View, a new instance of DetailController gets created by the segue and has to be filled with content? Why is that? Through debugging I can see that there is at least one DetailController instance staying alive all the time but not used on iPhone, and everytime I

Without subclassing a UIView or UIViewController: possible to catch if a subview was added?

蓝咒 提交于 2019-12-23 04:51:16
问题 Is there a way to catch an event or notification if a view was added as subview to an existing view of a controller? I have a library here and I cannot subclass but need to know if a specific subview was added to trigger a custom action. Is there a chance? 回答1: Not that I think this method is cleaner than the one @tiguero suggested, but I think it's slightly safer (see why using categories could be dangerous in my comments to his answer) and offers you more flexibilty. This is somehow,

How to implement a Photoshop Curves editor in UIKit

旧城冷巷雨未停 提交于 2019-12-23 04:04:28
问题 I'm familiar with UIBezierPath and the corresponding CG routines, but none of them appear to draw the same type of path as what I see in Photoshop, etc. How would one go about this? I'm just talking about the UI--letting the user drag around points. A java example I found is here: http://www.cse.unsw.edu.au/~lambert/splines/natcubic.html 回答1: I would look into CGContextAddCurveToPoint and drag around curve's control points. If you require more control points to create a complex curve, just

UIDocument autosave not working when calling updateChangeCount

人走茶凉 提交于 2019-12-23 03:45:28
问题 I have a custom subclass of UIDocument that I use to store the user's content for my app. I call -[UIDocument updateChangeCount:UIDocumentChangeDone] directly to track changes to the document. Saving and loading work fine, but the document never autosaves. Why would this be happening? 回答1: It turns out that the problem was that I wasn't calling -[UIDocument updateChangeCount:] from the main thread. Despite the fact that UIDocument isn't a UI element, it is still part of UIKit and so the usual

How to present a view full-screen in SwiftUI?

早过忘川 提交于 2019-12-23 03:43:31
问题 I worked to a login view , now I want to present the view after login, but I do not want the user to have the possibility to return to the login view . In UIkit I used present() , but it seems in SwiftUI presentation(_ modal: Modal?) the view does not take the entire screen. Navigation also isn't an option. Thank you! 回答1: I do not want the user to have the possibility to return to the login view In that case you shouldn't be presenting away from the login view but replacing it entirely. You