objective-c

How To Create A Gallery on iOS

Hi! I'm starting to develop a simple application for iOS, and this application is a simple gallery of some photo (taken from a website). The first problem I encountered is how to create the view for the gallery. The view should be something like this (or the Photo App): however doing a view this way is problematic, first because it us...

Yet Another IPhone Memory Management Question

So say I'm getting results from my core data request: (this is example code) On a button press event it does: NSMutableArray *results = [[myContext executeFetchRequest:request error:&error] mutableCopy]; myObject = (MyObject *)[mutableFetchResults1 objectAtIndex:0]; // assume that there's something in there Now I want myObject to sti...

Should I use @property (retain) for a @dynamic property setter that is retaining?

I have the following code for a property whose getter/setter I write manually using the @dynamic keyword: @property (nonatomic, retain) NSObject* obj; @dynamic obj; -(NSObject*) obj { return obj; } -(void) setObj:(NSObject*)newObj { [obj release]; obj = [newObj retain]; } My question is, if I remove the retain from the @p...

Parsing XML Code Question

I found the following tip for parsing XML in Objective-C on a post on this site. However, y always seems to equal null. I'm wondering if someone can clarify what is going on here. NSString * q = [myURL query]; NSArray * pairs = [q componentsSeparatedByString:@"&"]; NSMutableDictionary * kvPairs = [NSMutableDictionary dictionary]; for (...

Do I need to import the AppDelegate_Phone.h file?

Do I need to import the AppDelegate_Phone.h file (which in turn imports AppDelegate_Shared.h)? I am trying to use Core Data. The AppDelegate_Shared.h already has it set up. If I want to read information into a UITableView from Core Data, must I import my delegate file explicitly? ...

LocationManger use empty string for Latitude and logitude

hello guys, i am using the locationManager. I get the error "system.invaildCastexception" cause i fill my NSString lat and lng with (null). I want to fill them with nothing. how can i fill my NSString with nothing. lat=[[NSString alloc] initWithString:@""]; does not work. Best Regards ...

Opening email attachment in iPad

Hey, am writing an application to try out ideas and want to be able to open/save email attachments similar to what happens with good reader, does anyone know of a good tutorial that explains how to do this? Thanks, William ...

instance variable is unknown in the same controller

My code is really simple. One TableViewController with an instance variable "dataArray", the table is filled as the view appears. Problem: when I click on one of the entries (didSelectRowAtIndexPath), my app crashes. After debuging this example I have figured out, that "dataArray" has no objects at this time, but why? How can I display ...

How is it possible to access function of app A from app B

I was wondering if and in how many way an app can access specific funcions of another app. for example open an url in safari/firefox/chrome run a javascript in current browser-tab play/pause itunes rename selected files in Finder I am aware of the existence of applescript but i was wondering if that's the only way i have to int...

Does an approximation of C++'s "const methods" exist for Objective-C?

Wondering if there's any accepted practice for approximating C++'s 'const methods' in Objective-C. (new to the language from a C/C++ background) For instance: class Foo { public: void canChangeMemberVars(void); char* asString(void) const; }; "asString()" gets a const this pointer, so even if you go rogue and decide to mu...

Adding Core Data in Universal app?

I'm trying to add Core Data to an app that loads news form of an RSS feed so I can store articles offline. I am using ASIHTTP to load the data off of the internet as XML. I'd like to store the articles in Core Data so I have them the next time I start. My AppDelegate_shared already is set up for Core Data, based on the template, but I'...

Received memory warning in modal view -- parent view controller's objects get released. How to prevent?

My root view controller is a map with several annotations. When an annotation is selected and the accessory button is tapped, I display a modal view that looks like so: http://i.imgur.com/hACyH.png In this modal view, you can get a street view look at the annotations coordinate (I do this using a UIWebview). You can also submit a phot...

Detect signature of selector

How can I check the signature of the selector, or whether the selector requires parameters or not? E.g. I want to check whether the selector is of type -(void) method or -(void) method:(id)param ...

IPhone: Why does my app resume and not restart when I relaunch it on device?

I don't know if this is an iOS4 thing or something, but basically say I have a few screens in my app. Now, when I hit the home button and relaunch my app it launches the app on the screen where I left off. It's almost like it's not restarting my app, but resumes it. I don't want it to do that. (I'd like it to show my splash screen main m...

Creating mapkit's showsUserLocation pin ripple animation

Hi All, Has any one successfully created user location pin that has a ripple like effect that 4.x (or higher) mapkit gives when we use mkMakkit.showUserLoaction = YES; If any one has done it please guide me how to do it or past sample code that does that effect. The user location in the mapkit is read-only property. Has anyone able to...

Why do I get SIGABRT after the first iteration of this my for loop?

I feel very stupid for asking this, but I've been trying to figure this for about three hours and have gotten nowhere. See the code below. After the first iteration, my program crashes and all I get is SIGABRT. As you may get from the code, I'm just trying to build a string from other strings. It works fine on the first iteration, bu...

Is it advisable to send/return data in .plist format to/from an API being accessed via iOS?

We're deciding between using JSON vs. Property List (binary) for our API, which will be accessed by iPhone/iPad/iPod Touch. Are there any speed advantages? ...

How can I refresh a NSFetchedResultsController?

I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler plate code provided by Xcode when choosing to create a Core Data project. I added the following predicate to the NSFetchRequest the NSFetchedResultsController uses (before NSFetchedResultsController is initialized): NSPredicate *predicate = [N...

add sounds, buttons and image on the function of button programmatically

hello , i want to know i add sound & image or label on the function of button which is created prgrammatically on the click of button. firstly my sound was working fy9, but after adding image and label on that same function , sound is not working. help ME! Anks..... ...

How to change this code so the NSMutableArray is sorted?

I made a custom class. This is the h file @interface Player : NSObject { NSString *name; NSNumber *points; } @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSNumber *points; -(id) initWithName:(NSString *)n andPoints:(int)p; @end This is the m file #import "Player.h" @implementation Player @sy...