When my application is closed, the main controller class removes itself as Observer from the model and then releases the model. Like this:
- (void)dealloc {
[theModel removeObserver:self
forKeyPath:@"myValue"];
[theModel release];
[super dealloc];
}
And right after that, the debugger says:
2010-04-29 ...
I'm relatively well versed in CoreData and have been using it for several years with little or no difficulty. For the life of me, I can't figure out why
insertNewObjectForEntityForName:inManagedObjectContext:
is all of a sudden returning some sort of strange instance of NSNumber. GDB says the returned object is of the correct custom s...
I'm trying to take a CGImage and copy its data into a buffer for later processing. The code below is what I have so far, but there's one thing I don't like about it - it's copying the image data twice. Once for CGDataProviderCopyData() and once for the :getBytes:length call on imgData. I haven't been able to find a way to copy the ima...
I have a fullscreen view (768x1004), when I add a fullscreen subview to this view, it is incorrectly positioned by the height of the status bar (20 pixels). So the view will be clipped by 20 pixels at the top. I can't figure out why this is happening. The only way I can fix it is to set the origin to CGPointMake(0, 20) in viewDidLoad.
I...
Hello,
In classic MVC the model notifies the view about changes made on it. In C# this means I have to subclass the View I'm interested in and in the subclassed class register to the model's event. For example,
if I were to implement MVC using C# and Winforms, I had to subclass TextBox class and then register inside the MyTextBox's cons...
I'm somewhat new to objective-c and I'm not sure what the correct memory management for this code is.
const unsigned char * data =(const unsigned char *) [string UTF8String];
When I call free on data I get an error. Do I need to clean up after this call?
thanks!
...
It seems that no matter what orientation I am supporting on my views in my app, when I display a view with presentModalViewController, the app snaps into portrait view. How can I support different orientations with a modal view controller?
...
Does anyone have a GKVoiceChat example for the iPhone SDK in 4.0 or later? I would really appreciate it if they could share it with me. It will surely help with my iphone game.
Sincerely,
Kevin
...
Hi,
I am currently writing an XML parser that parses a lot of data, with a lot of different nodes (the XML isn't designed by me, and I have no control over the content...)
Anyway, it currently takes an unacceptably long time to download and read in (about 13 seconds) and so I'm looking for ways to increase the efficiency of the read.
...
Hi, I will be really fast, in my app I've a UITabBarController, in one tab I've implemented a TTThumbViewController but when it appears my tabbar disappears and I lose the primary navigation in my app. What is the right way to implement it?
Thanks
...
- (void) doSomething: (id)with {
int a;
a = [with doSomething];
}
How does the compiler know what type [with doSomething] is going to return? Does it assume an int, since that's what I'm assigning to?
...
I have a Cocoa app which interacts with a server and displays a GUI. If there is a fatal error, I display an alert and exit. I'd like to set the exit status to a non-zero value to reflect that an error occurred, for ease of interaction with some other UNIX based tools.
Unfortunately I've been unable to find a good way to do so - NSAppli...
Hi,
Please clarify, how to deal with returned objects from methods?
Below, I get employee details from GeEmployeetData function with autorelease,
1. Do I have to retain the returned object in Process method?
2. Can I release *emp in Process fucntion?
-(void) Process
{
Employee *emp = [self GeEmployeetData]
}
+(Employee*) GeEmploye...
hi friends
I am making a game in cocos2d , In that while updating score the old score values get on the label and the new value get overwritten. I m using following code to display the score,
LblScore = [CCLabel labelWithString:[NSString stringWithFormat:@"%d",score] dimensions:CGSizeMake(100, 300) alignment:UITextAlignmentCenter font...
Hi,
I have the data as customerFromDate " 01 Apr 2010 " and customerToDate " 30 Apr 2010 " which is a string.
I want to convert that format into yyyy-MM-dd it should be in string. but while doing so.
I got null values.
Please see the following code which I had tried.
printf("\n customerFromDate %s",[customerStatementObj.customerFromD...
Hey guys!
I have found the iPhone's keyboard bounds in the apple documentation, but I can't find the iPad's keyboard bounds. Could you please help me?
...
Hi everyone!
I need in a iPhone app to access files that the app is build with(.plist etc). There's an hardcoded way to do this:
NSString *appDir = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
objectAtIndex:0]
stringByDeletingLastPathComponent]
...
Hi, I just familiarise myself with the CLLocationManager and found several sample class definitions that contain the following init method:
- (id) init {
self = [super init];
if (self != nil) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self;
}
...
I want a custom class object to hold data and have somehow the feeling that creating about 80 properties is not the best way of doing it.
Most of the properties would be bool values, so i'm thinking about creating Arrays (keys / values) or (probably better) a NSDictionary attached to the object for holding the data. Does that make sense...
Hi,
i want to auto post to a user wall from my iphone applications ( without that "publish" "skip" dialog box ). how i can do that ?
...