將項目列表加載到UITableview並能夠單擊並顯示所選行的警報。但是,在提示「ok」後,我重新點擊已經選擇的行,我的代碼就會出現「Thread 1:Program received signal:EXC_BAD_ACCESS」。請看下面的代碼。UITableView didSelectRowAtIndexPath錯誤 - 再次選擇項目時
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *playerselected = [exercises objectAtIndex:indexPath.row];
NSString *video = [playerselected valueForKey:@"video"];
NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@", video];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Player selected"
message:msg
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[video release];
[msg release];
}
請教我這裏有什麼問題。
好的,我看了一下。你有什麼特別的問題嗎?只是在開玩笑,儘管如果你提出一個具體的問題,它會有所幫助,並儘可能詳細地解釋你的問題(例如錯誤發生在哪一行)。只需簡單地傾銷代碼就不會成爲其他人提供幫助的良好動機。 – Mac
Sry MAc糾正了上述問題。 – UnlimitedMeals