iphone-sdk-3.0

shouldAutorotateToInterfaceOrientation called several times in a row without any rotation

谁说我不能喝 提交于 2020-01-14 03:36:05
问题 I am trying to implement some interface changes in my app, based on the device rotation. My app is a view based app. So, its main view controller has a didload method. The app starts in portrait. Almost all changes on the device orientation triggers the shouldAutorotateToInterfaceOrientation method but this method is not called when the device is put on portrait, after coming from any landscape orientation. While debugging the app, I have put a NSLog(@"orientation=%d", interfaceOrientation);

MPMediaItem - NSCoding problem with MPMediaItemArtwork

微笑、不失礼 提交于 2020-01-11 03:09:54
问题 So MPMediaItem conforms to NSCoding, but it contains a pointer to MPMediaItemArtwork, which doesn't conform to NSCoding. So if I try to archive a MPMediaItem, if that item has some artwork in it, it will not be able to unarchive. I tried to make a category of MPMediaItemArtwork and make it conform to NSCoding, but I can't seem to do that because we don't have access to the actual UIImage that it stores. Does anyone know of any other creative ways to get around this problem? I want to be able

iPhone CoreData join

我是研究僧i 提交于 2020-01-10 03:18:09
问题 this is my core data model: I'm trying to get all LanguageEntries from a database for a given category.categoryName and languageset.languageSetName e.g. NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"LanguageEntry" inManagedObjectContext:del.managedObjectContext]; [fetchRequest setEntity:entity]; NSString* predicateString = [NSString stringWithFormat:@"Category.categoryName = %@ AND LanguageSet.languageSetName =

Reverse Geocode Current Location

孤者浪人 提交于 2020-01-09 07:38:11
问题 Is it possible to reverse Geocode your current location on SDK 3.x? I need to simply get the zip code of the current location. The only examples I've seen use CoreLocation which I dont think was introduced until SDK 4. 回答1: You can use MKReverseGeocoder from 3.0 through 5.0. Since 5.0 MKReverseGeocoder is depreciated and usage of CLGeocoder is advised. You should use CLGeocoder if available. In order to be able to extract address information you would have to include Address Book framework.

Detecting call duration in my App

亡梦爱人 提交于 2020-01-07 04:35:09
问题 I have app and it is running and at that time the call is comming and after sometime i cancel that call can i find the duration of Call. 回答1: You can look at CTCoreTelephony framework provided in iPhone sdk. It provides classes and methods to access call and carrier related information. 来源: https://stackoverflow.com/questions/7021417/detecting-call-duration-in-my-app

How to write sqlite select statement for NULL records

你。 提交于 2020-01-07 02:48:13
问题 I have a column which contains null values in some of the rows. I want to do sum of the column values by writing a select statement in sqlite. How do I write the statement so that it treats null values as 0. My current sqlite statement: select sum(amount) from table1 gives error as it returns null. Please help. 回答1: You can use ifnull(x,y) or coalesce(x,y,z,...) function. Each of them return the first non-null value from the parameter list from left to right. ifnull has exactly two parameter

Images too large under iOS 3.2

感情迁移 提交于 2020-01-06 19:31:22
问题 I noticed that when I test my app on the iPad 3.2 software, my buttons on the keypad do not look correct, they are enlarged. When I test it on the 4.0 or above, everything looks great. Any suggestions of what is going on? I'll be more than happy to post code, just don't know which part to post? Keep in mind the buttons are not enlarged like this in 4.0 or above. Are there any programming difference between the two. Also, all these buttons were created in interface builder. 回答1: Are you using

How to store values of JSON in ARRAY/ String

本小妞迷上赌 提交于 2020-01-06 16:18:39
问题 I have the following JSON value: -( { Key = IsEmail; Value = 1; }, { Key = TrackingInterval; Value = 20; }, { Key = IsBackup; Value = 1; }, { Key = WipeOnRestore; Value = 1; } ) How might I go about parsing this object into an array or string? - i.e. eack key values to be stored in an array and each Value to be stored in another array. Please help me out with this. Thanks :) 回答1: This approach uses the json-framework. I've shortened your example: NSString *jsonString = @"[{\"Key\":\"IsEmail\"

UItableView + UItabbar

寵の児 提交于 2020-01-06 15:20:10
问题 UItableView style not changing. I have a tableView controller as one of the tabs of my tab bar controller. I am not able to change the style of UItableView to grouped. Please help, 回答1: I would create a new tableViewController and make sure to enable the "also create xib"-like option when giving the tableviewcontroller a name. Copy paste all youre old tablviewcontroller code to the new one and add the xib to the tab window.. 回答2: You must specify the Tableview's style upon creation. Either in

How to Copy Array Objects which are in Different Tabs

◇◆丶佛笑我妖孽 提交于 2020-01-06 08:44:11
问题 I have NSMutable Array in FirstviewController. I want to copy objects of that array to another NSMUtable Array which is in SecondViewController. But FirstViewController and SecondViewController are in different tabs (my app's rootController is a tabBarController ) Note: I know It's work for [self.navigationController pushViewController:firstViewController animated:YES]; But, how can I do it when viewControllers are in different tabs like in my case. please give me a help. thanks in advanced.