objective-c

Rotated 2d rectangle intersecting points or area

Moving ahead from previous question.I have two rectangle and they look like this: struct Rect { NSPoint topLeft; NSPoint topRight; NSPoint bottomLeft; NSPoint bottomRight; } I use something similar code to check whether rectangles intersects(or collision) . In case If 2 rectangles intersects I want to calculate the area of in...

Saving High Score Data

I am extreamly new to programming. I am writing a simple game which gives you a score everytime you run the game. I am trying to figure out how to save the scores and recall them to a high score page. I am trying to figure out if saving to a dictionary is the best way, or using an array, or what. Plus, how does the dictionary handle ...

Big activity indicator on iPhone

Does anyone know how to show a rounded squared with a spinning activity indicator? It is used in many apps. If you don't know what im talking about, it looks like the indicator when you change volume on your Mac but with a darker background. Im not sure if it is built-in to iOS or someone made it. Like the one in this post but not full ...

xml data text + binary

Hello all, I built iphone app that getting inforamtion from server(this is server that i built also). the data from the server is type XML and i use the xml parser to parse the message. what i want is to add image to be send from the server and i am asking if i cann add binary data such image to the xml message.for example 10 tags will b...

Objective-C NSMutableArray: Problem with sorting objects?

I currently have an object called Station defined as: @interface RFStation : NSObject { NSString *stationID; NSString *callsign; NSString *logo; NSString *frequency; @end I also have an NSMutableArray containing a list of 'Station' objects. I need to have a method to sort these objects by the 'stationState' attrib...

release int in objective-c

do you need to release int in objective-c? How can we tell if something needs to be released or not? ...

Difference between NSArray and NSMutable Array

hi am working with NSArrays using foundation tool and i have wrote the following code -(void)simplearrays { NSMutableArray *arr = [NSMutableArray arrayWithCapacity:3]; for(int i =0;i<3;i++) { scanf("%d",&arr[i]); } for(int j =0; j<3;j++) { printf("\n%d",arr[j]); } } My query is that the above code when executed shows ...

background application

in my application i have a voice who play every 30 min i put my code in - (void)applicationDidEnterBackground:(UIApplication *)application it's working great on simulator and on device but when someone call me or i call someone the application will terminate and don't play the sound again :( can anybody help me to solve the problem ?...

how to use RSA encryption for the iPhone

Greetings, being a newbie with these kinds of things, I'd just want to know how to do RSA encryptions in objective C? I shall be using it on an iPhone app I'm developing if anyone could point to a simple tutorial on the matter, it would be greatly appreciated. Thank you in advance ...

How to understand the syntax of message with multiple arguments in Objective C?

I know Objective C uses 'interleaved arguments', and it is by design. But I want to know why you think it makes life easier to merge the name of the first argument into the message name. See below: Correct: [myRectangle setOriginX: 30.0 y: 50.0] instead of Wrong: [myRectangle setOrigin x: 30.0 y: 50.0] [receiver message argument1:v...

Objective-C Section Headers not appearing correctly?

I have a Station object defined as: @interface RFStation : NSObject { NSString *stationID; NSString *callsign; NSString *logo; @end I also have an NSMutableArray called 'StationList' which is a list of Station objects. This list is sorted alphabetically by 'callsign'. I also have another NSArray called 'generalList', c...

Deleting object from array

i'm working on app for iphone on objective-c i have array with object references If i remove item with object reference from array should i release this object additionally or it will be removed from memory automatically? ...

release function in objective c

In Objective-C all objects can be released from memory using release function ? ...

copy NSMutableArray item

I am copying a mutable array like this: //copy players' info into playerList from a dictionary playerList = [[NSMutableArray alloc] initWithArray:[params objectForKey:@"p"] copyItems:YES]; The items in the array implement copyWithZone like this: - (id)copyWithZone:(NSZone *)zone { PlayerInfo* copy = [[[self class] allocWithZone:zo...

programmatically retrieve project directory in xcode objective-C project

How do I retrieve the project directory of an xcode project targeted for the ipad? Or if it isn't possible, then how do it retrieve the home directory of the user? something like: NSString *path = [NSProject getPath];//could be absolute or relative or NSString *homeDir = [NSURL getUserDirectory]; ...

Combining a UILongPressGestureRecognizer with a UIPanGestureRecognizer

I d'like to combine a UILongPressGestureRecognizer with a UIPanGestureRecognizer. The UIPanGestureRecognizer should start with a long press. Is there a simple way to do this? or do I really have to write my own gesture recognizer? I wan't something like on the home screen. You press on an icon and after some time the icons start wobbl...

How to save entire class to NSUserDefaults?

I have a custom class full of BOOLs, ints, NSStrings, NSMutableArrays etc. Is there a way to save the class as a whole to NSUserDefaults (and load it)? If so, how would I do it? ...

Create a second Window

Hi I want to run an OpenGlView in a second window. I can open this window "simualtion", but there is nothing to see, which I created in the Interface Builder. I think the problem is that I created a completely new window. I try this way, because I want to close the old window and open the new one with one and same method, because I want ...

How to store custom objects with struct in Coredata

I have to store a custom class object to Coredata. The problem is my custom class contains structs,enum etc.I tried following method. -(void)encodeWithCoder:(NSCoder *)encoder . But am getting this error [NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs' What is the best practice to store this ...

NSFetchedResultsController delegate allocating too many UITableViewCells

I'm using an NSFetchedResultsController in a standard way to update a UITableView whenever something changes in the related core-data entities. I'm doing the same as described in the Apple documentation. The problem I have is when I make a mass insert of new core-data entities. This causes the NSFetchedResultsController delegate to al...