ios

What's the proper way to read/write to a plist?

In my app I store some user data in two .plist files which already contain some data, but the user can change it. NSString *Path = [[NSBundle mainBundle] bundlePath]; NSString *DataPath = [Path stringByAppendingPathComponent:@"Settings.plist"]; NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] initWithContentsOfFile:DataPa...

Can I play loops using Audio Toolbox?

hello all, in my app i use AudioToolbox framework and i need to play a loop can i ? this is the AVAudioplayer code that goes slowly with 2 touches simultaneously - (AVAudioPlayer *)getNoteFromFilename:(NSString *)name andoftype:(NSString *)type{ NSString *soundPath = [[NSBundle mainBundle] pathForResource:name ...

Where should I perform a Reachability check?

I want to check for a valid network connection. I followed Apple's Reachability example and put my check in applicationDidFinishLaunching #pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if(getenv("NSZombieEn...

Add suffix to file name before extension

What's the simplest way to add a suffix to a file name before the extension in Objective-C? Example Original name: image.png Suffix: ~ipad Result: image~ipad.png ...

Why can't I set the InputView property of my UITextView on iPhone?

I am trying to replace the Standard Keyboard on the iPhone with a custom one which I have created in MainKeyboard.xib, which is linked to the UIView outlet mainKeyboard. I have the following code that executes when the main view loads, and I have also tried triggering it with a UIButton for testing purposes. [[NSBundle mainBundle] loadN...

resize and crop image centered

Hi, so currently i'm trying to crop and resize a picture to fit it into a specific size without loosing the ratio. a small image to show what i mean: i played a bit with vocaro's categories but they don't work with png's and have problems with gifs. also the image doesn't get cropped. does anyone have a suggestion how to do this re...

Core data, how to get NSArray of child object's ObjectIDs only?

I have a Core Data object, card, which has a child relationship relatedCards, which references other card objects. I am trying to get Core Data to give me an NSArray of the relatedCards' ObjectID values only—not the other property values for the cards. I know that one option is to run a fetch request such as: Card *myCard = <something> ...

Core data, how to get NSManagedObject's ObjectId when NSFetchRequest returns NSDictionaryResultType?

I have an NSFetchRequest which is returning the objects' properties in an NSDictionaryResultType. Is it possible to also get the objects' ObjectId within this dictionary? Otherwise I will need to run the query with a return type of NSManagedObjectResultType which is much slower for a large number of returned items. ...

iPad and memory problems

Hi, is it possible, that when the iPad application is forcibly closed/killed by the iOS becuase of 'out of memory situation', the memory the application allocated is not 100% released? I think that the memory allocated directly by the client is released - there is even HW support for this, but we were observing that if the application i...

Adding new button into virtual keybroad of iphone ( keybroad appear when you touch on a UITextField)?

How to add new button into virtual keybroad of iphone ( keybroad appear when you touch UITextField)? ...

How can I get the average value of a column with Core Data?

Hi Guys, If I have the following NSManagedObject, how can I get the average of number1 and number2. @interface Log : NSManagedObject { } @property (nonatomic, retain) NSNumber * number1; @property (nonatomic, retain) NSNumber * number2; Thanks :D ...

Are there any good open source iOS application templates out there?

I was wondering if anyone knows of any good open source app templates out there. I've been noticing that I commonly use a few open source projects in every app that I write, like appirater, flurry, in app settings kit, etc. Does anyone know of any app templates out there that use any of these already? Thanks! ...

Why does a subclass @property with no corresponding ivar hide superclass ivars?

The following seems simple enough. There's a superclass with an ivar, and a subclass which accesses the (@protected) superclasses ivar: // Testclass.h @interface TestClass : NSObject { NSString *testIvar; } @end //TestClass.m @implementation TestClass @end //TestSubclass.h @interface TestSubClass : TestClass { } @property (no...

is there a way to control the iPod Touch’s keyboard orientation using JavaScript?

Hi, I was wondering if there is a way to control the orientation of the iPod Touch’s keyboard from JavaScript? When the using is in landscape, the keyboard is always displayed in portrait mode which is causing problems with my static positioning of many elements. Is it possible to control the keyboard’s orientation in Javascript? Than...

Problem subclassing UIAlertView in an InputAlertView different sizes and position between iOS4 e iOS3

I've got a problem understanding why a subclass of UIAlertView seems to be drawn in different ways in iOS3 and iOS4. My project must work under iOS4 (base sdk) and iOS3.1.3(deployment target). In that project I subclass a UIAlertView for creating an InputAlertView that is similar to the one that ask you pwd when you buy on the AppStore ...

Why are some entities NSManagedObjects and some named after their class?

I've noticed that in my Core Data data model, some entities are (in the top-left panel) have a class of 'NSManagedObject' and some are named after a class (Person, Company etc). There doesn't seem to be any logic in whether the entity has a class of NSManagedObject of Person etc. And my code seems to work ok. So I'm wondering why there i...

How do I obtain information about the pages in a UIScrollView?

I have a run of about 10 different methods, they all pass "page" and "index" between them in order to define a ScrollView with multiple pages. The majority of these methods run within a loop (for each page). I'm working on a way to re-orient and re-position the pages depending on the device orientation. My trouble now is trying to get a...

How to access controller items in view when created programatically?

Hi - I'm fairly new to iOS programming, I've just managed to make a view completely programatically (no interface builder)...but now I'm wondering how I access the different elements such as a UILabel or UISwitch etc. In IB I'd just connect them up to their respective outlets / ibactions, how do I do it when I've created it the view from...

Core Animation Image sequence

How would i go about creating an image sequence with core animation. I would like to: add image1 for 1 second then remove image add image2 for 2 seconds then remove image add image1 for 3 seconds then remove CGImageRef image1 = [self getImage1]; CALayer *image1Layer = [CALayer layer]; image1Layer.bounds = CGRectMake(0, 0,...

Difference between add to target & add to project in XCode

I am trying to inegerate Google Toolbox for mac for unit testing purposes on this page http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting is says add blahblah.m file to your target & add blahblah.m file to your project. What is the difference, how should I add to target... ...