-
TableView
2017-08-24 09:06:05tableView = cc.TableView:create(cc.size(810, 440)) tableView:setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL) tableView:setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN) tableView:setColor(cc.c3b(255,2tableView = cc.TableView:create(cc.size(810, 440))
tableView:setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL)
tableView:setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN)
tableView:setColor(cc.c3b(255,255,255))
tableView:setPosition(cc.p(10, 10))
tableView:setDelegate()
imgBk:addChild(tableView)
tableView:registerScriptHandler(function(tableView)
return 1
end, cc.NUMBER_OF_CELLS_IN_TABLEVIEW)
tableView:registerScriptHandler(function(tableView, idx)
return 960, 640
end, cc.TABLECELL_SIZE_FOR_INDEX)
tableView:registerScriptHandler(function(tableView, idx)
local pDelCell = tableView:dequeueCell()
while (pDelCell ~= nil) do
pDelCell:removeAllChildren()
pDelCell:removeFromParent()
pDelCell = tableView:dequeueCell()
end
local cell = tableView:dequeueCell()
if cell == nil then
cell = cc.TableViewCell:create()
local cellBg = ccui.ImageView:create("ac_bk.png", 1)
cellBg:setPosition(cc.p(cellWidth / 2.0, cellHeight / 2.0 + 5))
cellBg:setScale9Enabled(true)
cellBg:setContentSize(cc.size(cellWidth - 10,90))
cell:addChild(cellBg)
end
return cell
end, cc.TABLECELL_SIZE_AT_INDEX)
tableView:reloadData()
-- tableView:registerScriptHandler(CueResultLayer.scrollViewDidScroll,cc.SCROLLVIEW_SCRIPT_SCROLL)
-- tableView:registerScriptHandler(CueResultLayer.scrollViewDidZoom,cc.SCROLLVIEW_SCRIPT_ZOOM)
-- tableView:registerScriptHandler(CueResultLayer.tableCellTouched,cc.TABLECELL_TOUCHED)
-- tableView:registerScriptHandler(CueResultLayer.cellSizeForTable,cc.TABLECELL_SIZE_FOR_INDEX)
-- tableView:registerScriptHandler(CueResultLayer.tableCellAtIndex,cc.TABLECELL_SIZE_AT_INDEX)
-- tableView:registerScriptHandler(CueResultLayer.numberOfCellsInTableView,cc.NUMBER_OF_CELLS_IN_TABLEVIEW)
-- function CueResultLayer.scrollViewDidScroll(view)
-- end
-- function CueResultLayer.scrollViewDidZoom(view)
-- end
-- function CueResultLayer.tableCellTouched(table,cell)
-- end
-- function CueResultLayer.cellSizeForTable(table,idx)
-- return 960,640
-- end
-- function CueResultLayer.tableCellAtIndex(table, idx)
-- local cell = table:dequeueCell()
-- while ( cell ~= nil ) do
-- cell:removeFromParent()
-- cell = table:dequeueCell()
-- end
-- if nil == cell then
-- cell = cc.TableViewCell:new()
-- local propId, propgrade = CueResultLayer:analysisInfo(CueResultLayer.reslutList[idx + 1])
-- local cellBg = ccui.Scale9Sprite:createWithSpriteFrameName("Gray_Bg.png")
-- cellBg:setContentSize(cc.size(CELL_WIDTH, CueResultLayer._cellHeight[idx]))
-- cellBg:setPosition(cc.p(CELL_WIDTH/2, CueResultLayer._cellHeight[idx] / 2))
-- cell:addChild(cellBg)
-- end
-- return cell
-- end
-- function CueResultLayer.numberOfCellsInTableView(table)
-- return 1
-- end -
tableView
2017-01-06 10:29:57// 告诉tableView的真实高度是自动计算的,根据你的约束来计算 self.tableView.rowHeight = UITableViewAutomaticDimension; // 告诉tableView所有cell的估计行高 self.tableView.estimatedRowHeight = 44iOS8 , 自动计算Cell高度// 告诉tableView的真实高度是自动计算的,根据你的约束来计算self.tableView.rowHeight = UITableViewAutomaticDimension;// 告诉tableView所有cell的估计行高self.tableView.estimatedRowHeight = 44row 刷新<span style="font-size:14px;">NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1inSection:0]; [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];</span>
section 刷新<span style="font-size:14px;">NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:0]; [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationNone];</span>
headerview黏性<span style="font-size:14px;">#pragma mark - scrollView delegate //delete UItableview headerview黏性 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView == self.tableView) { CGFloat sectionHeaderHeight = 10; if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); } } [self.view endEditing:YES]; }</span>
设置字母索引背景色为透明//设置字母索引背景色为透明 if ([self.tableView respondsToSelector:@selector(setSectionIndexColor:)]) { self.tableView.sectionIndexBackgroundColor = [UIColor clearColor]; self.tableView.sectionIndexTrackingBackgroundColor = [UIColor clearColor]; //设置字母索引文字颜色 self.tableView.sectionIndexColor = DWDColorMain; }
解决ios8及以上分割线有边緣问题// 解决ios8及以上 分割线有边緣问题 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } } // 解决ios8及以上 分割线有边緣问题 -(void)viewDidLayoutSubviews{ if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { [self.tableView setSeparatorInset:UIEdgeInsetsZero]; } if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) { [self.tableView setLayoutMargins:UIEdgeInsetsZero]; } }
设置区头颜色//设置区头颜色 - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{ UITableViewHeaderFooterView *v = (UITableViewHeaderFooterView *)view; v.backgroundView.backgroundColor = [UIColor blackColor]; }
-
TableView嵌套tableView
2018-09-07 17:22:20多个tableView嵌套 滑动上一个tableView停留,接着滑动下一个tableView -
iOS tableview里面嵌套tableview,自适应高度
2018-03-15 18:37:30swift ,使用autolayout + storyboard 最外层tableview列表,cell里面嵌套了tableview,自适应内容,cell里的tableview不可滑动,内容全部显示,且文字分行显示,不用设置cell的高度直接可以自适应内容 -
Mac tableview
2017-04-27 17:17:22使用习惯了iOS的tableview,在使用mac os tableview的时候还是有很大差别的。iOS tableview是单列。mac os tableview可以创建好几列。 一个最基本的mac os tableview使用 创建新的工程习惯不去勾选storyboard选项...使用习惯了iOS的tableview,在使用mac os tableview的时候还是有很大差别的。iOS tableview是单列。mac os tableview可以创建好几列。
一个最基本的mac os tableview使用- 创建新的工程习惯不去勾选storyboard选项
- 进到项目之后删除掉MainMenu.xib中的Window
- 创建一个继承自NSWindowController的一个window。
- 在AppDelegate中导入刚建的window,并且设置为主窗口
- 设置完AppDelegate就该去设置xib文件。创建xib好几次失败所以写下这篇博客,让给后来人有所帮助
操作xib文件
把一个tableview拖进window中,展开会发现在Tabel View下面默认创建了两个cell,需要给这两个cell重新命名 例如Name/Image
下面的按照此方法炮制。
这时候运行你会发现window头部会出现你刚才命名的header- 接下来就是系统给的cell不能满足这个demo的需求选中删掉
- 掉
- 下面不能满足需要按照此方法删掉
- 重新拖进去控件
- 下面的拖进去一个label
- 此时运行并没有发现什么作用
- 需要给刚才新拖进的控件命一下名字
- 做到这一步基本差不多了,就是给tableview拖线,设置代理
- 这时候运行数据还出不来,因为没有添加代理
- 好几次脱线失败原因是没有找对对象
选中Tabl View 往file woner上面拖代理。这是比你会发现file woner会出现这几个条件
可以放心去控制器里面设置数据了
#import "MainWindowController.h" @interface MainWindowController ()<NSTableViewDelegate, NSTableViewDataSource> @property (strong) NSMutableArray *tableContents; @property (weak) IBOutlet NSTableView *tabelView; @end @implementation MainWindowController - (NSString *)windowNibName { return @"MainWindow"; } - (void)windowDidLoad { [super windowDidLoad]; self.window.title = @"table"; NSArray *tableData = @[@"NSQuickLookTemplate", @"NSBluetoothTemplate", @"NSIChatTheaterTemplate", @"NSSlideshowTemplate", @"NSActionTemplate", @"NSSmartBadgeTemplate", @"NSIconViewTemplate", @"NSListViewTemplate", @"NSColumnViewTemplate", @"NSFlowViewTemplate", @"NSPathTemplate", @"NSInvalidDataFreestandingTemplate", @"NSLockLockedTemplate", @"NSLockUnlockedTemplate", @"NSGoRightTemplate", @"NSGoLeftTemplate", @"NSRightFacingTriangleTemplate", @"NSLeftFacingTriangleTemplate", @"NSAddTemplate", @"NSRemoveTemplate", @"NSRevealFreestandingTemplate", @"NSFollowLinkFreestandingTemplate", @"NSEnterFullScreenTemplate", @"NSExitFullScreenTemplate", @"NSStopProgressTemplate", @"NSStopProgressFreestandingTemplate", @"NSRefreshTemplate", @"NSRefreshFreestandingTemplate", @"NSBonjour", @"NSComputer", @"NSFolderBurnable", @"NSFolderSmart", @"NSFolder", @"NSNetwork", @"NSMobileMe", @"NSMultipleDocuments", @"NSUserAccounts", @"NSPreferencesGeneral", @"NSAdvanced", @"NSInfo", @"NSFontPanel", @"NSColorPanel", @"NSUser", @"NSUserGroup", @"NSEveryone", @"NSUserGuest", @"NSMenuOnStateTemplate", @"NSMenuMixedStateTemplate", @"NSApplicationIcon", @"NSTrashEmpty", @"NSTrashFull", @"NSHomeTemplate", @"NSBookmarksTemplate", @"NSCaution", @"NSStatusAvailable", @"NSStatusPartiallyAvailable", @"NSStatusUnavailable", @"NSStatusNone"]; // Load up our sample data. _tableContents = [NSMutableArray array]; // Our model consists of an array of dictionaries with Name/Image key pairs. for (NSString *templateImageItem in tableData) { NSImage *image = [NSImage imageNamed:templateImageItem]; NSDictionary *dictionary = @{@"Name": templateImageItem, @"Image": image}; [self.tableContents addObject:dictionary]; } [self.tabelView reloadData]; } // The only essential/required tableview dataSource method. - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { return self.tableContents.count; } // This method is optional if you use bindings to provide the data. - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { // Group our "model" object, which is a dictionary. NSDictionary *dictionary = self.tableContents[row]; // In IB the tableColumn has the identifier set to the same string as the keys in our dictionary. NSString *identifier = tableColumn.identifier; if ([identifier isEqualToString:@"MainCell"]) { // We pass us as the owner so we can setup target/actions into this main controller object. NSTableCellView *cellView = [tableView makeViewWithIdentifier:identifier owner:self]; // Then setup properties on the cellView based on the column. cellView.textField.stringValue = dictionary[@"Name"]; cellView.imageView.objectValue = dictionary[@"Image"]; return cellView; } else if ([identifier isEqualToString:@"SizeCell"]) { NSTextField *textField = [tableView makeViewWithIdentifier:identifier owner:self]; NSImage *image = dictionary[@"Image"]; NSSize size = image ? image.size : NSZeroSize; NSString *sizeString = [NSString stringWithFormat:@"%.0fx%.0f", size.width, size.height]; textField.objectValue = sizeString; return textField; } else { NSAssert1(NO, @"Unhandled table column identifier %@", identifier); } return nil; } @end
注意:我多次使用在创建windowController的xib文件没有成功,于是删掉xib。重新建xib。
http://www.jianshu.com/p/e9119da446d5 -
qml tableview
2020-12-07 21:47:33tableview的排序功能,qt官方示例有,可以參考做,qt官方实例如下: Qt Quick Controls 1 - Table View Example QML type registration: #include <QtQml/qqml.h> ... qmlRegisterType<...tableview的排序功能,qt官方示例有,可以參考做,qt官方实例如下:
Qt Quick Controls 1 - Table View Example
QML type registration:
#include <QtQml/qqml.h>
...
qmlRegisterType<SortFilterProxyModel>("org.qtproject.example", 1, 0, "SortFilterProxyModel");
...
QML namespace import:
import org.qtproject.example 1.0
主要是使用SortFilterProxyModel实现表头排序功能
关于tableview右键点击功能,qt quick control 1.4没有支持,只有onClicked事件,只支持鼠标左键,
可以修改源码加上右键点击事件,这里就不细说了,就是仿照qt源码里面的clicked事件,左右一个
类似与rightClicked事件就可以触发右键点击功能了
关于表头支持复选框的功能可以自定义实现,不如可以使用一个Rectangle覆盖表头第一个Column,
做一个checkButton,再与tableView里面的数据列表关联就可以了,可以使用类似这样的自定义功能
目前暂时没有看到qt自己支持表头第一column有复选功能,所以可以采用这样的自定义实现
-
tableView切换频繁崩溃问题
2017-07-11 14:19:28tableView -
IOS TableView组件五:TableView分组列表
2019-05-28 11:30:19文章目录使用取消tableview默认的分割线创建一个自定义的分割线重用方式创建完plist文件后,在model文件中对应创建属性。获取plist文件:cellview需要一个更新函数注册了和没注册的区别设置有多少项,和每项的头高和... -
点击tableView的cell弹出tableView
2016-06-15 13:37:01点击大TableView的cell 弹出小的tableView列表 选择,选择完毕将内容返回到大TableView(数值)中,同时小tableView 消失 -
iOS tableview切换不同数据源,tableview滚动到分区第一行,tableview滚动位置不准确
2020-04-15 14:36:27//关闭tableview的预估cell,heard &foot高度,解决tablevie滚动指定位置不准确 _tableview.estimatedRowHeight = 0; _tableview.estimatedSectionHeaderHeight = 0; _tableview.... -
TableView2
2016-01-28 20:09:57#ifndef __TableView_H__ #define __TableView_H__ #include "cocos2d.h" #include "cocos-ext.h" USING_NS_CC; USING_NS_CC_EXT; class TableView : public Layer, public TableViewDataSource { public: TableV -
TableView详解
2015-12-13 16:40:06最近突然发现,其实每个应用程序,里面的界面都是用TableView形成的,只不过,每个自定义的Cell是不一样的,所以,之前只是粗略的看了一下TableView的相关知识,这次把它重点研究了一下,把其中遇到的一些问题mark... -
IOS tableview 使用
2019-04-13 13:41:522 tableview 3 [self.tableView registerNib:[UINib nibWithNibName:@"ParkCell" bundle:nil] forCellReuseIdentifier:@"cellID"]; self.tableView.delegate = self; self.tableView.dataSource =... -
TableView dataSource
2014-10-30 10:27:46MainViewController.m #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView ...- (NSInteger)tableView:(UITableView *)tableView number -
Tableview自适应展示
2018-07-02 16:34:17设置UITableView自动计算高度 ...- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 0.01; } - (CGFloat)tableView:(UITableView *)tabl... -
熟用TableView
2019-09-25 23:02:17self.title = @"分组表视图...UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 568) style:UITableViewStylePlain]; //设置tableView数据源代理 tableView.dataSource = self... -
tableView代码块
2018-11-28 16:26:57tableView代码块 #pragma mark --------=====tableView - (UITableView *)tableView{ if (!_tableView) { _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, <#kScreenW#>, <... -
QT之Tableview
2019-01-16 20:47:25想要了解更多的tableview可以看这位博客Qt深入浅出(十五)QTableView 这里做了一个简单的学生系统查询功能显示Tableview: 表格视图控件QTableView,需要和QStandardItemModel, 配套使用,这套框架是基于MVC设计... -
iOS tableVIew的偏移量
2017-09-20 12:08:30监听tableVIew的偏移量 获取cell的frame -
ios tableview
2013-05-08 14:10:32集成UITableViewDataSource, UITableViewDelegate ...tableView:numberOfRowsInSection:行数 tableView:cellForRowAtIndexPath:行内容 tableView:indentationLevelForRowAtIndexPath:前缩进 tableVie -
iOS 解决tableView中headerView头部视图不跟随tableView滑动的方法
2020-04-21 09:33:14iOS 解决tableView中headerView头部视图不跟随tableView滑动的方法
-
转行做IT-第6章 IDEA、方法
-
【数据分析-随到随学】Mysql数据库
-
2021最新Kubernetes(k8s)集群实战精讲
-
iapp获取电量代码
-
python数据分析基础
-
【2021】UI自动化测试Selenium3
-
第3章 入门程序、常量、变量
-
华为Magic(HI3650V100方案)维修图PCB位置图(PDF格式)
-
IPC/JEDEC-J-STD-035:非密封电子元件的声学显微镜法-英文完整版(17页)
-
Kotlin协程极简入门与解密
-
易语言显示鼠标座标.e
-
CINTA作业十二
-
acuity切台.pdf
-
性能测试面面观
-
RPC 用着好好的?为什么还需要使用 MQ?
-
Arrays分类算法-ArrayOf Products
-
阿里云云计算ACP考试必备教程
-
中文说明worldserver.conf
-
CPP-Summit 2019 - 吴咏炜 - 深入浅出 C++20 协程.pdf
-
python办公自动化技巧