我想建立一個應用程序來播放iPhone上的本地音頻文件,但我堅持使用我的一些代碼。 我想知道如何推送視圖,回到uitableviewcontroller並使用按鈕(如媒體播放器中的「現在播放」按鈕)返回視圖,而不需要推入任何新字符串。如何推送視圖,返回並返回視圖?
謝謝你
我應該怎樣改變我的密碼?
中的UITableViewController..
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath {
selectedSong = [directoryContent objectAtIndex:indexPath.row];
NSString *storyLin = [[directoryContent objectAtIndex:[indexPath row]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
patch = [NSString stringWithFormat:@"/%@", storyLin];
myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];
myDetViewCont.myProgLang = selectedSong; // assigning the correct value to the variable inside DetailViewController
[self.navigationController pushViewController:myDetViewCont animated:YES];
[myDetViewCont release]; // releasing controller from the memory
}
在mPlayerViewController.m
-(IBAction) backtoplayer{
myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];
}
AMAZING !!!!謝謝你們兩位!但是,我怎樣才能防止每次有人點擊uitableviewController中的一行(歌曲)時創建一個新的mPlayerViewController? (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath :(NSIndexPath *)indexPath {myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@「mPlayerViewController」bundle:nil]; ' – Alby 2011-03-18 05:18:37