Sorry for the multitude of iPhone Programming newb questions but..
what is the reason for having an unsigned type for something such as
- (unsigned)count
for the NSArray class.
Why not just define it as
- (int)count
?
...
I'm having a bit of a problem trying to get touchesBegan to respond to multi touch.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet *allTouches = [event allTouches];
for (UITouch *touch in allTouches)
{
CGPoint location = [touch locationInView:touch.view];
if(CGRectContainsPoint(snare.frame, location) && l...
Hello,
I'm creating a date like this :
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY"];
NSInteger year = [[dateFormatter stringFromDate:[NSDate date]] intValue];
NSLog(@"NSInteger YEAR : %...
I have a simple foundation tool that exports every frame of a movie as a .tiff file. Here is the relevant code:
NSString* movieLoc = [NSString stringWithCString:argv[1]];
QTMovie *sourceMovie = [QTMovie movieWithFile:movieLoc error:nil];
int i=0;
while (QTTimeCompare([sourceMovie currentTime], [sourceMovie duration]) != NSOrderedSame) ...
Hi Frnz,
Can we use CLLocationManager class to determine the position of the user in an iPad app or is it used only for iPhones?
...
Okay, from what I understand, an integer that is a fraction will be rounded one way or the other so that if a formula comes up with say 5/6 - it will automatically round it to 1. I have a calculation:
xyz = ((1300 - [abc intValue])/6) + 100;
xyz is defined as an NSInteger, abc is an NSString that is chosen via a UIPicker. I want the...
Hi guys.
I have an NSMutableArray object(retained, synthesized as all) that is initiated just fine and I can easily add objects to it using the 'addObject:' method. But if I want to replace an object at a certain index with a new one in that NSMutableArray, it doesn't work.
For example:
ClassA.h
@interface ClassA : NSObject {
NSM...
I get a crash with this console message:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFArray row]: unrecognized selector sent to instance 0x3953a20'
This happens when I scroll trough a table that gets its data from an array of dictionaries.
...
Update:
Using the following gets back an XML response. Used NSXMLParser to check for "errors" element. Not the cleanest method but gets the job done. I am open for suggestions.
NSURLResponse *response;
NSError *error;
NSData* result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString ...
I'm writing a GUI for MongoDB using Cocoa. It's going well, but I don't know how to make KVO properties that would be lazily loaded. How does one handle that?
For instance, viewing the documents in a Mongo collection. The collection might have a million items in it. I suspect I shouldn't be downloading the full 2-5 GiB of data to my Coc...
Hi,
I'm working in a project for the iPad, it is a small program and I need it to communicate with another software that runs on windows and act like a server; so the application that I'm creating for the iPad will be the client.
I'm using CFNetwork to do sockets communication, this is the way I'm establishing the connection:
char ip[...
I'm writing a Cocoa application, with a GUI designed in Interface Builder. I need to schedule background activity (at regular intervals) without blocking the UI, so I run it in a separate thread, like this:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[self performSelectorInBackground:@selector(schedule) w...
I feel like I'm missing something basic here, and I would appreciate it if you'd help me pull it all together.
Let's say that I have two view controllers... ViewAController and ViewBController.
If I wanted to show viewA, I would do this:
ViewAController *new_view = [[ViewAController alloc] initWithNibName:@"ViewAController" bundle:nil...
If I have a UIDatePicker, and I wish to set the minimum and maximum date range to be between thirty years ago and thirty years in the future, how would I set that up?
...
I have an NSDictionary and want to iterate over the objects. But at the same time, I need to know the key of the dictionary.
I remember there was a special, fancy form of fast enumeration, but have forgotten the exact syntax.
Anyone?
...
I'm attempting to make a simple app that stores and displays flash cards, however I'm having an awful time getting my SQLite to work. The database connection is fine, but when I try an insert, it crashes and gives no indication of what went wrong. This is the code I am using to insert the flash card into the table.
const char *insert =...
I'm building an iPad app that allows users to save files in it and I want users to be able to open and import documents from other applications to my application. For example, I know that if you received an email and you want to save the attachment to my application, you're able to click on it and "Open with..." and choose the applicatio...
http://itunes.apple.com/us/app/angry-birds/id343200656?mt=8&ign-mpt=uo%3D6
So I am getting started with this all game dev thing on iphone and I decided that I will start playing with Cocos2d as my starting engine.
Now just so i have a goal in mind, I picked angry birds as my initial target of what sort of game play would I like to...
the file that I need the users information in already has a -flipsideViewControllerDelegate-, so Is there a way that I can get the users location coordinates without using the CLLocationManagerDelegate thing?
...
Given all the complex things I seem to cover every day, this appears to be a "what the heck am I doing wrong that seems to simple?" scenario!
I would like to subclass an NSTextField to change the background color and text color. For simplicity sake (and to help anyone who hasn't ever subclassed anything before), here is the example of m...