久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

UITableView 一次只勾選一行

UITableView Checkmark ONLY ONE Row at a Time(UITableView 一次只勾選一行)
本文介紹了UITableView 一次只勾選一行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

使用此代碼,我可以檢查表中的多行.

With this code, I can check multiple rows in a table.

但我想要的是一次只檢查一行.這是我的代碼:

But what I want is to only have one row checked at a time. Here's my code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    UITableViewCell *theCell = [tableView cellForRowAtIndexPath:indexPath];
    
    if (theCell.accessoryType == UITableViewCellAccessoryNone) {
        theCell.accessoryType = UITableViewCellAccessoryCheckmark;
    } else if (theCell.accessoryType == UITableViewCellAccessoryCheckmark) {
        theCell.accessoryType = UITableViewCellAccessoryNone;
    }
}

如果用戶選擇了不同的行,那么我希望舊行簡單地自動取消選中.不知道該怎么做.

If a user selects a different row, then I want the old row to simply automatically uncheck. Don't know how to do that.

推薦答案

最好的方法是在cellForRowAtIndexPath中設置附件類型.

The best way is to set the accessory type in cellForRowAtIndexPath.

使用didSelectRowAtIndexPath只記錄應該選擇哪條路徑,然后調用reloadData.

Use didSelectRowAtIndexPath to only record which path should be selected and then call reloadData.

這篇關于UITableView 一次只勾選一行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動運行/壓力測試 iOS 應用程序以找出罕見 UI 錯誤的原因?)
Can#39;t change target membership visibility in Xcode 4.5(無法更改 Xcode 4.5 中的目標成員身份可見性)
UITableView: Handle cell selection in a mixed cell table view static and dynamic cells(UITableView:在混合單元格表視圖靜態和動態單元格中處理單元格選擇)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中刪除 Safari 中的地址欄?)
iOS 5 SDK is gone after upgrade to Xcode 4.5(升級到 Xcode 4.5 后,iOS 5 SDK 消失了)
主站蜘蛛池模板: 久久精品视频在线免费观看 | 日本爱爱视频 | 91tv在线观看 | 国产精品久久久久久久久久 | 国产综合网站 | 黑人一级片视频 | 在线成人福利 | 免费三级av | 特级做a爰片毛片免费看108 | 国产精品一区二区无线 | 可以在线观看av的网站 | 国产精品久久777777 | 在线免费观看a级片 | 美女在线国产 | 久久精品99国产精品日本 | 国产伦精品一区二区三区精品视频 | 91在线中文字幕 | 黄色av网站在线观看 | 久草精品在线 | 国产一区二区激情视频 | 久久久精品一区 | 欧美精品区 | 精品国产乱码久久久久久丨区2区 | 国产精品美女久久久免费 | 亚洲 欧美 精品 | 中文字幕视频在线 | 国产精品久久久久影院色老大 | 成在线人视频免费视频 | 成人精品鲁一区一区二区 | 成人免费黄视频 | 国产精品视频一区二区三区 | 欧美久久久久久久久中文字幕 | 欧美一级片在线看 | 成人a视频 | 国产精品国产a级 | 天堂在线91 | 日韩免费网站 | 精品国产乱码久久久久久1区2区 | 午夜影院中文字幕 | 国产成人精品一区二区三区 | 精品一区二区三区中文字幕 |