I'm just starting out (reading up a lot for the past couple of days). Here's some questions that I have stacked up, hopefully someone can answer them.
1. the (self != nil) check in initializer code. Why do it? To prevent accidental access to some "run-only-once" code that's wrapped up in there? Where from could this accidental access co...
The object in question consists of key/value pairs aka @property. Is there an elegant way to encode/decode this object to a dictionary? It seems brute force to manually pull out each attribute and create the dictionary by hand.
...
In Actionscipt, Parent means the object which contains the instance. So if a car has a wheel, wheel can tell the car to move forward with
parent.moveForward
However, in Obj-C, parent refers to the super class (not sure why they have super and parent mean the same thing).
I can't find any equivalent to the Action-script style parent,...
Is it possible to create a simple objective C object in xcode that has some basic test code, and then execute just this object, ala execute an alternative main()?
ie I have an LdapWrapper class and I want to write an LdapWrapperTest class that I can run on demand (it cant be part of the build process as it depends on access to an ldap s...
I know it's been asked before (like here), but is there way to natively use XSLT on the iPhone? If not, and I need to use libxslt, is there any documentation/tutorial of how to use it on the iPhone?
EDIT:
I've decided to use libxslt. What files are necessary to include? I haven't found any tutorials of examples of use on the iPhone, and...
I want to send the data of a UIImage to the server through a socket, so I:
a) open NSOutputStream
- (IBAction)send:(id)sender {
NSURL *website = [NSURL URLWithString:str_IP];
NSHost *host = [NSHost hostWithName:[website host]];
[NSStream getStreamsToHost:host port:1100 inputStream:nil outputStream:
[oStream retain];
...
I'm trying to use a UITableViewController (delegate & dataSource for the view) to display a simple table read from a Plist. The Plist contains a NSDictionary which itself contains several NSDictionary objects that represent objects used in my application.
The rest of the code looks something like this (simplified):
- (void)viewDidLoad ...
I have UITableViewController as the RootViewController. I need to add rows to the table depending on data I get from another thread which I initiate from the RootViewController's thread. When I retun back from other thread to my RootViewController's thread I have the updated data, But I can't update the TableView. I called the [self.tabl...
Which is better approach between use of NSDictionary and NSObject with NSStrings as properties, in terms of faster performance and efficient memory management, if the code is written for an iPhone application?
E.g. If an application deals with parsing an XML file which is as follows:
< ?xml version="1.0" encoding="utf-8" ?>
< FirstNa...
I want to send out an NSArray, so I have to write it to an NSOutputStream first.
The method should be :
- (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length
I can convert the array's pointer to uint8 _ t using : (uint8_t *)arr
But how to get the length of bytes of the array? Do I have to save the array to a file an...
In xCode 3, I defined private instance variables in a class. When I directly access the private variables in the client codes, why does the compiler just show me a warning, not an error? The code can still run. The warning says this maybe a hard error in the future. What does the "hard error" mean? Thanks.
...
In PHP I can do this:
$new = str_replace(array('/', ':', '.'), '', $new);
...to replace all instances of the characters / : . with a blank string (to remove them)
Can I do this easily in Objective-C? Or do I have to roll my own?
Currently I am doing multiple calls to stringByReplacingOccurrencesOfString:
strNew = [strNew stringByRe...
Hi,
I need to keep track of rows in sections in my UITableView. For this I want to create an array in which I put an amount of rows in each section. This array should be of a certain size - so I suppose it would be better to use NSArray instead of NSMutableArray.
My question is - how can I initialize it with a certain number of objects...
Hi, I want to implement index feature in UITableView as is in the standart contacts application.
Is there an elaborate tutorial how to achieve this goal? What is the right way to do so?
Data in my table is sorted alphabetically and when a user presses on a certain letter in the index I want to scroll to the same letter in the table.
H...
Hopefully, this question isn't a dumb as I fear it sounds, but it may still be pretty dumb.
I'm new to Objective-C, and Cocoa. In fact, I'm completely new to C in general. I'm trying to implement an iPhone game using Cocos2d-iPhone. It's a game I've made before in Flash, so I thought it would be a nice way to lean Objective C, cocoa an...
At the risk of oversimplifying something I'm worried might be ridiculously complex, what should I be aware of when mixing C and Objective-C?
Edit: Just to clarify, I've never worked with C before, and I'm learning Objective-C through Cocoa. Also I'm using the Chipmunk Dynamics engine, which is C.
...
There's a joke in there somewhere.
Anyhoot. In the following code, the setForceVector method has no actual effect on the value of member it's attempting to change. By checking the log, I can see the function is being called (by another object handling to a touchEvent).
I've used NSLog to check that the forceVectorfromControls is actu...
Problem: I have a set of images, lets say 5. There is an structure that defines an "image object" in the meaning of my context.
Every such image object has this information:
name, of the image file (ie "myImage.png")
xOffsetPx
yOffsetPx
width
height
The images are supposed to be shown on very specific positions in an view, so I need...
I want to animate the position of a CALayer based on a CGPath, but I want to play it backwards.
Is there any way to animate a path backwards, or reverse a CGPath?
...
How do you append a NSInteger to NSMutableData. Something allong the lines of...
NSMutableData *myData = [[NSMutableData alloc] init];
NSInteger myInteger = 42;
[myData appendBytes:myInteger length:sizeof(myInteger)];
So that 0x0000002A will get appended to myData.
Any help appreciated.
...