我有此代碼 NSString * localStringValue;將一個字符串從DidSelectRowAtIndexPath傳遞到按鈕單擊操作
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
localStringValue = [m_textfield cellForRowAtIndexPath:indexPath].textLabel.text;
localStringValue = [m_textfield cellForRowAtIndexPath:indexPath].detailTextLabel.text;
NSArray* toReload = [NSArray arrayWithObjects: indexPath, self.selectedIndexPath, nil];
self.selectedIndexPath = indexPath;
if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryCheckmark){
UploadView *uploadview = (UploadView *)self.view;
if (uploadview != nil)
{
[m_owner uploadString:localStringValue];
//[self dismissModalViewControllerAnimated:YES];
}
[[m_textfield cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryNone];
}
else {
[[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];
}
}
在此代碼我正在同步localStringValue到谷歌文檔,當我點擊單元格,如果複選標記there.localStringValue
包含在tableview中cell.Every事工作正常,在此point.But我需要的值是我想這個值傳遞給點擊一個按鈕,這意味着如果用戶選擇多行我想在localStringValue所有值,並通過這個代碼通過這個
- (IBAction)doUpload:(id)sender
{
UploadView *uploadview = (UploadView *)self.view;
if (uploadview != nil)
{
[m_owner uploadString:@""];
//[self dismissModalViewControllerAnimated:YES];
}
}
我想在[m_owner uploadString:localstringvalue];
如何localstringvalue通去做這個? 在此先感謝。
它顯示錯誤「接口類型字符串不能通過值傳遞」你忘了NSString「這是我的錯誤和未聲明的本地字符串 – ICoder