When I run the program everything works and the alert sheet comes up, but when I click the "OK" button to delete the folder, it does nothing, just sits there. What am I doing wrong? Any suggestions would be a great help.
Here is the alert sheet part of the implementation file...
-(IBAction)deleteFolderNSButton *)sender
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *title = @"Are you sure you want to delete your created folder?";
NSString *defaultButton = @"YES";
NSString *alternateButton = @"NO";
NSString *msg = @"your friendly reminder";
NSBeginAlertSheet(title,
defaultButton,
alternateButton,
nil,
window,
self,
@selector(sheetDidEnd:returncCode:contextInfo,
nil,
nil,
msg);
[pool release];
}
-(void)sheetDidEndNSWindow *)sheet returnCodeint)returnCode contextInfovoid *)contextInfo
{
if (returnCode == NSAlertDefaultReturn)
{
NSFileManager *nsf = [NSFileManager defaultManager];
[nsf removeFileAtPath"/Users/joeb/Desktop/NewFolderMan/" handler:nil];
}
}
Here is the alert sheet part of the implementation file...
-(IBAction)deleteFolderNSButton *)sender
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *title = @"Are you sure you want to delete your created folder?";
NSString *defaultButton = @"YES";
NSString *alternateButton = @"NO";
NSString *msg = @"your friendly reminder";
NSBeginAlertSheet(title,
defaultButton,
alternateButton,
nil,
window,
self,
@selector(sheetDidEnd:returncCode:contextInfo,
nil,
nil,
msg);
[pool release];
}
-(void)sheetDidEndNSWindow *)sheet returnCodeint)returnCode contextInfovoid *)contextInfo
{
if (returnCode == NSAlertDefaultReturn)
{
NSFileManager *nsf = [NSFileManager defaultManager];
[nsf removeFileAtPath"/Users/joeb/Desktop/NewFolderMan/" handler:nil];
}
}