When I attempt to define an int as a property in Objective C i get an error (not of type object). I have tried using NSInteger and int but neither work.
code:
int seat;
@property (nonatomic, retain) int seats;
...
In other languages I could create a class then use this to create an array of objects in that class eg class price which is used in a performance class to define a price[] prices;
in objective C i cant get this to work, how do you do it?
The price class is an inherit of NSObject, can I use NSMutableArray?
...
I would like to find an iPhone OpenGL ES Example that responds to touch.
Ideally it would meet these requirements:
Displays a 3D object in the center of the screen like a cube
Maps a texture to the cube surfaces
Should move the camera around the cube as you drag your finger
Should zoom the camera in and out on the cube by pinching
Opt...
I want to do this:
[[ClassA new] addObject:[[ClassA new] addObject:[ClassA new]]];
but the compiler returns:
"error: invalid use of void expression"
Is there a way to do it? like in java:
ClassA = new ClassA( new ClassA( new ClassA()));
...
Ok, I have a problem with building a socket using Objective-C. If you'll take a look at my code below, through help with example code and other sources, I was able to build a complete socket I believe. The problem is that when I compile it, it builds fine (no syntax problems), but there are no sockets being created. As you'll notice I've...
I'm trying to watch a variable with Xcode. I'm following the instructions in here by pausing at a breakpoint, selecting Run > Variables View > .... but with the exception of "Enable Data Formatters" the rest of the options are all greyed out. Any ideas?
I'm using Xcode Version 3.1.3 if that matters.
...
I'm trying to build a application that allows the user to either A) enter a new person, or B) select a person from their contacts... My question is on item B. I've read briefly about loading Modal view controllers, but, was hoping someone could point me in the direction of a tutorial or article talking specifically about that kind of use...
I'm having a strange problem with adding a UINavigationController to my iPhone application. I add the controller as follows:
myViewController *viewController = [[myViewController alloc] initWithNibName:@"myView" bundle:nil];
myNavigationViewController *navigationController = [[myNavigationViewController alloc] initWithRootViewControlle...
There is a newly introduced issue with iPhone 3.0 SDK and how it deals with the NSURL method for automatically making phone calls. It used to be that you could call a method (NSURL), pass in a string with a URL prefix (tel://, sms, etc...) and the iPhone OS would dispatch the message to the device, such as iTunes, App Store, Phone, SMS,...
Hi,
As you may have guessed from the question - I am right at the beginning of the Obj-C journey.
I'm hoping that someone out there knows of some diagrams that depict the relationship between classes, objects and methods - and that they're willing to share.
The problem I'm having is that just looking at code in a textbook doesn't comp...
In doxygen, I can create objective-c categories inside my implementation file to hide interfaces that shouldn't be accessed publicly. However, doxygen still documents the category as the members being "public". Even by adding the \protected or \private, this is still the case.
Is there another method that I'm overlooking that would put...
I'm confused about NSUserDefaults on the iPhone.
I come from a C / asm background and the Objective-C stuff has been a learning experience.
I'm currently using NSUserDefaults to store some strings (for the names in a highscore table). I want to start implementing a "Save Game" type feature so if the user gets a call or exits out of th...
I have overridden a synthesized property because I wanted to add an NSAssert.
Is this OK to do (i.e override) or considered bad practice?
@synthesize someField;
-(NSString*)someField {
NSAssert(someField != nil,@"someField");
return someField;
}
Thanks
...
I'm new to the iPhone App development so it's likely that I'm doing something wrong.
Basically, I'm loading a bunch of images from the internet, and then cropping them. I managed to find examples of loading images asynchronous and adding them into views. I've managed to do that by adding an image with NSData, through a NSOperation, whic...
When I send an object to NSLog, I get a string with three attributes. First is the class of the object, second is the frame of the object, and third is the CALayer of the object. The second and third attributes are titled (e.g. layer = ), so I can call them by the title (e.g. myObject.layer).
The first one isn't. How do I test for the c...
Scenario:
I have a Distributed-objects-based IPC between a mac application and a launchd daemon (written with Foundation classes). Since I had issues before regarding asynchronous messaging (e.g. I have a registerClient: on the server's root object and whenever there's an event the server's root object notifies / calls a method in the c...
What is the appropriate way of dealing with large text files in Objective-C? Let's say I need to read each line separately and want to treat each line as an NSString. What is the most efficient way of doing this?
One solution is using the NSString method:
+ (id)stringWithContentsOfFile:(NSString *)path
encoding:(NSStringEncoding...
I'm wondering what decides whether you're allowed to use < > or " " when you're importing files in objective c. So far my observation has been that you use " " for the files in your project that you've got the implementation source to, and < > when you're referencing a library or framework. But how exactly does that work? What would I ha...
Hi Guys,
I am fairly new to programming and I am working with Objective C. I am trying to program an app where you have a UITableView, than you click on cell, which will bring you to another UITableView with more options. I have only encountered problems, however, in populating this second UITableView. Any suggestions for how to do t...
I'm looking for a way to change the pitch of recorded audio as it is saved to disk, or played back (in real time). I understand Audio Units can be used for this. The iPhone offers limited support for Audio Units (for example it's not possible to create/use custom audio units, as far as I can tell), but several out-of-the-box audio units ...