I am implementing a open button.
- (IBAction)open:(id)sender {
NSInteger selectedRow=[tableview selectedRow];
//if(selectedRow >=0) {
NSString * paths=[myRecentFile objectAtIndex:selectedRow];
NSLog(@"%@", [myRecentFile objectAtIndex:selectedRow]);
[[NSWorkspace sharedWorkspace] openFile:(NSString *)paths withApplication:@"MainMenu"];
}
But I cannot open it correctly. MainMenu is nibname. paths is the path of the my file which type is MainMenu. myRecentFile is NSSarray which stores different paths corresponding to the tableview row.
It looks like you have a list of Nibs that you want to load, using an “open” button. You probably want to use NSBundle’s loadNibNamed:owner: class method for the nibs, like the following:
However,
nibNameshouldn’t contain any path information, which it seems your table provides. You may want to read Apple’s Loading Nibs Programmatically to find the best solution to the problem you are trying to solve.