ios4

Implementing concurrent read exclusive write model with GCD

拜拜、爱过 提交于 2020-01-01 15:47:08
问题 I am trying to understand the proper way of using Grand Central Dispatch (GCD) to implement concurrent read exclusive write model of controlling access to a resource. Suppose there is a NSMutableDictionary that is read a lot and once in awhile updated. What is the proper way of ensuring that reads always work with consistent state of the dictionary? Sure I can use a queue and serialize all read and write access to the dictionary, but that would unnecessarily serialize reads which should be

Can we display KML data on Google maps using Mapkit framework on iOS devices?

a 夏天 提交于 2020-01-01 12:42:29
问题 I have a requirement wherein I have to show some maps and some data corresponding to that maps. The problem is that the backend server uses MapXtreme to generate GIS data, and there is no MapX client for iOS devices. The server people tell me that they can send me KML files for generating the maps. Is there any way to use KML files to display geographic information on Google maps using Mapkit framework? EDIT: I have gone through a similar question in this link. In one of the answer vy32

Preventing MFMailComposeViewController from scaling animated GIFs

北城余情 提交于 2020-01-01 10:12:22
问题 I'm attaching an animated GIF to an email to be sent with MFMailComposeViewController. If the GIF is of sufficient size the MFMailComposeViewController will ask the user whether they want to resize it to a smaller size. Unfortunately, the animation will not be preserved in the resized image. How do I either forbid MFMailComposeViewController to resize the image or make it preserve the animation? 回答1: There’s no built-in API to do this, but one option is to compress the animated GIF into a ZIP

Preventing MFMailComposeViewController from scaling animated GIFs

匆匆过客 提交于 2020-01-01 10:11:56
问题 I'm attaching an animated GIF to an email to be sent with MFMailComposeViewController. If the GIF is of sufficient size the MFMailComposeViewController will ask the user whether they want to resize it to a smaller size. Unfortunately, the animation will not be preserved in the resized image. How do I either forbid MFMailComposeViewController to resize the image or make it preserve the animation? 回答1: There’s no built-in API to do this, but one option is to compress the animated GIF into a ZIP

iPhone UIWebview video playback 4.0

南楼画角 提交于 2020-01-01 07:35:12
问题 Now that 4.0 is public, I can edit this question and ask it again. This code works in 3.2 and any prior versions, but in 4.0 I get an alertView saying "This movie could not be played". ivar webView //in viewDidLoad self.webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; webView.scalesPageToFit = YES; webView.delegate = self; // in tableView didSelectRowAtIndexPath // url contains a video from web NSURL *url = [NSURL URLWithString:@"http://www.somevalid.td

Localizing app icons in iOS 4

为君一笑 提交于 2020-01-01 06:34:27
问题 Ok, this one is driving me crazy... I've had my app icon localized using InfoPlist.strings with language-specific CFBundleIconFile values (selecting different icon for each of the supported languages). Since iOS 4 this method no longer works, and I'm struggling to find one that does. Apple docs state that it should be enough to put correct Icon.png files in the appropripate language.lproj folders, but this doesn't seem to work for app icons (everything else gets localized just fine). I wonder

how to make button round with image background in IPhone?

戏子无情 提交于 2020-01-01 06:14:25
问题 I have a round button, but i will make it have a backgroud with image. but when i do it, by setting the (what) property to an image, the button becomes rectangle because the image is a rectangle. How do I keep the button round? 回答1: Simply by doing this #import <QuartzCore/QuartzCore.h> myButton.layer.cornerRadius = 8; 回答2: Tested Code: .h -(void)vijayWithApple; .m -(void)vijayWithApple{ NSLog(@"vijayWithApple Called"); } UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

Using applicationwillenterforeground for a passcode screen

风格不统一 提交于 2020-01-01 05:19:13
问题 Before iOS4, my app's initial view controller would check a passcode on/off settings variable in viewWillAppear and if set on, present a modal passcode screen that would stay there until the correct passcode was entered or the Home button was pressed. With iOS4, if my app has been in the background, I would like the user to feel comfortable that the data contained within the app is not easily accessible if they were to hand their phone to someone to use. Since the app could return to any

How to get an update NSUserDefault on iOS 4?

风流意气都作罢 提交于 2020-01-01 04:47:04
问题 I am developing an iPhone application, I encounter a problem on the iOS4 because of multi task. This application has the default settings defined in a Settings.bundle. If I run my application then I left it (so it goes in the background). I'll change the settings and restarts the application (it comes out of standby and method: applicationDidBecomeActive () is called). Values in NSUserDefault are not updates, but when I leave the application and relaunch. The values are good. Does someone

CLLocation distanceFromLocation

折月煮酒 提交于 2020-01-01 03:36:05
问题 I am using CLLocation to work out the distance from the current user location, and an annotation. However I just wanted to know if this would be correct. I am currently using iPhone Simulator for this and according to the MKMapView the iPhone Simulator is situated here: Lat: 0 Long: -1067024384 The annotation's position is: workingCoordinate.latitude = 40.763856; workingCoordinate.longitude = -73.973034; However if you take a look in google maps you will find out how close these distances are