2011-12-07 48 views
0

哈ii每一個身體我有一個tableview與它的一些數據,我想同步它與googledoc,我的需要是用戶可以選擇在tableview單元格中的多個選擇,並將這些註釋導出到Gdoc.So是否有任何方法桌面視圖中有多個選擇,帶有刻度線或複選標記? 。提前致謝。如何在UITableView中啓用多選?

+0

http://stackoverflow.com/questions/308081/is-it-possible-to-configure-a-uitableview-to-allow-multiple-selection可能的重複 –

回答

2

我找到了解決辦法

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    NSArray* toReload = [NSArray arrayWithObjects: indexPath, self.selectedIndexPath, nil]; 
    self.selectedIndexPath = indexPath; 
    if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryCheckmark){ 

     [[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryNone]; 
    } 

    else { 

     [[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark]; 

    } 

我們必須設置selectedindexpath屬性in.h中

@property (retain) NSIndexPath* selectedIndexPath; 

感謝。