There is nothing in the file, but I add row1 to my array right after. NSLog tells me that the array is empty. Why isn't row1 added to the array? All of my other code is fine as far as I can tell. My app worked when I put hard values into the array. Now that I'm loading from a file, it doesn't work.
- (void)viewDidLoad {
//array value
/...
Is there a reason why CFRelease does not check for NULL? Isn't it unacceptable when [nil release]; free(NULL); delete NULL; all work perfectly fine?
...
Is there a class method equivalent to -respondsToSelector:?
Something like +respondsToSelector:?
The reason I am asking is because by implementing -respondsToSelector: on a class level, I get a compiler warning: "found '-respondsToSelector:' instead of '+respondsToSelector:' in protocol(s)".
The code looks like this:
Class <SomeProto...
I was wondering if there is any sample code out there for objective-C for implementing a NSMutableArray of type struct. Inside, I need there to be 2 mutable arrays (via NSMutableArray also) declared in the struct. All the code samples in my book show me how to make an array of defined size via C array syntax (with the brackets), but I do...
Is it possible to have a small UITable in a view, where when you click a cell, the small table is transitioned to the detail level? I currently have it so that the whole screen slides to the detail level.
thanks
...
Hi,
I have made an application in which I have four tab bars. I have used the below code to go to the second view in a button's click method. It goes to the second view but the second view is not showing with tab bars. How can I fix this?
- (IBAction)Existinguser:(id)sender
{
ExistingUserViewController *existingUserViewController =
...
Hello all again.
My question is stated above in the title but I'll write it here again
Is it possible to copy a different plist into the application bundle code wise??
This is actually a bit related on my previous question ;) http://stackoverflow.com/questions/1125048/create-a-dictionary-property-list-programmatically
But since I ca...
Hi there,
I have an iphone app with 2 managed object contexts. One of my contexts deals with a picker, which allows the user to add new records and then select one of those new records. Once the picker is hidden, that managed object context is saved and discarded.
I then want to use this selected object in my second managed object con...
I've found this snippet of code on the net. It sets up an NSMutableArray in a way I've not seen before ( I'm an Obj-C newb). Can someone explain what it's doing and why you would do it this way? Particularly the @syncronized, static and little plus sign on the method signature.
add the following to the .h file:
+(NSMutableArray *)allMyS...
I'm using Core Data to store lists of data. So, there's parent objects with any number of child objects. Core Data does a great job keeping my memory use low while I'm inserting objects and reading but when I do a delete operation the memory spikes way up.
When I delete a parent object with ~5000 children the cascade delete uses ~10MB. ...
Ok a pretty simple question.. in c++ it seems to work but in objective-c i seem to struggle with it :S ..
If you want to compare two arrays it should be something like this right
for ( int i = 0; i < [appdelegate.nicearray count]; i++ )
{
if ( appdelegate.nicearray[i] == appdelegate.exercarray[i] )
{
NSLog(@"the same elem...
Please advise some way to extract MP3 attributes using simple API.
Is there any other libraries other than ID3.framework? I found that it is quite out-dated and has memory leaks. Thanks a lot.
...
Hello, I´m trying to animate a sort of draggable UIView where the behaviour should be something like this:
Drag along the screen following the touch of the user.
Detect a swipe touch and drag automatically with an initial speed and a negative acceleration that makes is stop after some time.
Something like moving around a photo and th...
I have following simple class:
@interface Article: NSObject {
NSString *title;
}
@property (copy, nonatomic) NSString *title;
@end
@implementation
- (void)setTitle:(NSString *)aString {
if ((!title && !aString) || (title && aString && [title isEqualToString:aString])) return;
dirty = YES;
[title release];
title = [...
This is an example from The Objective-C 2.0 Programming Language.
I was just wondering, in the setter at the bottom, can I use value = [newValue retain]
instead of value = [newValue copy] ?
@interface MyClass : NSObject
{
NSString *value;
}
@property(copy, readwrite) NSString *value;
@end
// assume using garbage collecti...
I'm trying to write a generic XML to Core Data parser using libxml2. Since I have control over both, the XML elements correspond exactly to the objects and the attributes to the properties of the objects. This is all fine and everything works well, except when the attributes are of a type other than NSString. I realize that selectors k...
I have an NSString like so:
@"200hello"
or
@"0 something"
What I would like to be able to do is take the first occuring number in the NSString and convert it into an int.
So that @"200hello" would become int = 200.
and @"0 something" would become int = 0.
...
Hey guys,
I have an init method defined as:
- (id)initWithX:(float)inX AndY:(float)inY
{
if (self = [super init])
{
[self setX:inX andY:inY];
}
return self;
}
When I use this method like this:
MyObject* myObject = [[MyObject alloc] initWithX:0.0 AndY:0.0];
I get a warning saying: "warning: initialization fro...
Im trying to move an object around the screen like in the game geometry wars. I can rotate the object just fine, however I cant seem to get it to move based on the direction it is facing. I have this code here which i think is right for doing this but I keep getting syntax errors:
spriteObject.x = spriteObject.x + speed*cos(Angle)
spr...
I hope I'm wording my question properly, but what I'm trying to do is actually rather trivial.
I have a bunch of code with static object instantiation that looks like this:
Foo *aFoo1 = [[[Foo alloc] init] autorelease];
[anArray addObject:aFoo1];
Foo *aFoo2 = [[[Foo alloc] init] autorelease];
[anArray addObject:aFoo2];
I simply want...