cocoa-touch

UIImageView vs UIView w/ Image - efficiency

喜你入骨 提交于 2019-12-31 22:26:17
问题 This is not really a question about addressing a specific problem but more a request to be pointed in the right direction. I am making an app where I am loading several images (saved as JPGs) onto a screen at the same time and this has to be the way it is, I can't unload any of them because they are all being shown at once. I tried loading 30 images at about 800px*600px resolution naively thinking that it only loads the 'compressed' size of the pictures into memory (this being about 200 KB) -

NSDecimalNumber decimalNumberWithString: ignores current locale

自闭症网瘾萝莉.ら 提交于 2019-12-31 21:53:28
问题 According to the documentation, [NSDecimalNumber decimalNumberWithString:] should use the locale decimal separator: Whether the NSDecimalSeparator is a period (as is used, for example, in the United States) or a comma (as is used, for example, in France) depends on the default locale. But when I try it, this code: NSLog(@"%@", [NSDecimalNumber decimalNumberWithString:@"100,1"]); NSLog(@"%@", [NSDecimalNumber decimalNumberWithString:@"100,1" locale:NSLocale.currentLocale]); Gives... 100 100.1

How to load a NIB inside of a view in another NIB?

浪子不回头ぞ 提交于 2019-12-31 21:22:31
问题 I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib contains a UIButton I want ChildViewController.xib to load in the ParentViewController.xib's UIView I have done the following: Created @property for UIView in ParentViewController Connected File's Owner to UIView in ParentViewController Set UIViewController in ParentViewController's NIB Name property to ChildViewController in Interface

iOS: Notification when MKMapView is loaded and annotations/overlays are added?

我只是一个虾纸丫 提交于 2019-12-31 18:42:29
问题 I am aware of the delegate methods used to let me know when the map has loaded and annotations and overlays have been added. ( mapViewDidFinishLoadingMap: mapView:didAddAnnotationViews: mapView:didAddOverlayViews: ) I am wanting to create a UIImage from my MKMapView once everything has loaded. Currently I am creating my UIImage once mapView:didAddOverlayViews: is called, but this is not always reliable, because sometimes the overlay take longer to be added, sometimes

How to align UITableViewCell to the bottom of the UITableView?

牧云@^-^@ 提交于 2019-12-31 17:24:05
问题 When you insert your first UITableViewCell with insertRowsAtIndexPaths:withRowAnimation: , it usually appears at the top of the UITableView . In the Periscope app, the opposite happens - the first inserted cell is bottom aligned. As new cells are pushed in, the old cells move up in the table. How is this achieved? 回答1: In case you're interested in how I did it in the Periscope iOS app, it's actually pretty simple... TL;DR; Add a transparent table header header view with a height equal to your

How to align UITableViewCell to the bottom of the UITableView?

試著忘記壹切 提交于 2019-12-31 17:23:12
问题 When you insert your first UITableViewCell with insertRowsAtIndexPaths:withRowAnimation: , it usually appears at the top of the UITableView . In the Periscope app, the opposite happens - the first inserted cell is bottom aligned. As new cells are pushed in, the old cells move up in the table. How is this achieved? 回答1: In case you're interested in how I did it in the Periscope iOS app, it's actually pretty simple... TL;DR; Add a transparent table header header view with a height equal to your

Flatten UIViews Subviews to UIImage iPhone 3.0

扶醉桌前 提交于 2019-12-31 16:51:14
问题 I have a UIView that has several UIImageViews as subviews. Each of these subviews has had different affine transform applied. I would like to take what amounts to a screen capture of my UIView, capturing it as a UIImage, or some other image representation. The method I have tried already, rendering the layers to a CGContext with: [view.layer renderInContext:UIGraphicsGetCurrentContext()]; doesn't preserve the positioning or other affine transformations of my subviews. I would really

Parsing nested JSON objects with JSON Framework for Objective-C

ε祈祈猫儿з 提交于 2019-12-31 16:39:10
问题 I have the following JSON object: { "response": { "status": 200 }, "messages": [ { "message": { "user": "value" "pass": "value", "url": "value" } ] } } I am using JSON-Framework (also tried JSON Touch) to parse through this and create a dictionary. I want to access the "message" block and pull out the "user", "pass" and "url" values. In Obj-C I have the following code: // Create new SBJSON parser object SBJSON *parser = [[SBJSON alloc] init]; // Prepare URL request to download statuses from

NSOperation blocks UI painting?

 ̄綄美尐妖づ 提交于 2019-12-31 13:13:41
问题 I'm after some advice on the use of NSOperation and drawing: I have a main thread create my NSOperation subclass, which then adds it to an NSOperationQueue . My NSOperation does some heavy processing, it is intended to loop in its main() method for several minutes, constantly processing some work, but for now I just have a while() loop with a sleep(1) inside, which is set to go around just 5 times (for testing). The main (original) thread which spawns this NSOperation is responsible for

Object Mapping library from JSON to NSObjects

橙三吉。 提交于 2019-12-31 13:12:10
问题 I am trying to build a parser/objectMapper that will build Objective C objects for the JSON I consume from a REST service. I took some inspiration from RestKit by having my Entities all hold a "decoding list" which tells a mapper which JSON keys goes with which objects. Like this: //ObjectEntity implementation + (NSDictionary*) mapProperties { /* localPropertiy - JSONProperty */ return @{ @"name": @"name", @"category": @"category", @"possible_scopes": @"possibleScopes", @"possible