iOS中对表格数据的修改

来源:互联网 发布:mac win10 iso 下载 编辑:程序博客网 时间:2024/04/28 07:14
最近刚学习写iOS的程序,在做应用程序本地化的过程中发现原本一个只有一个mainStoryboard.storyboard文件的,现在变成了几种语言几个,因为原来是直接在minStoryboard.storyboard上写死的,现在如果还用原来的方式 修改就要一个一个用手动去修改,工作量有点大,我就想直接在类里面修改吧,这样以后添加也方便。 在Class中找到对应的对象,下面是代码:
 [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].textLabel.text=@"myString";  
对代码做如下说明:
 self.tableView  //得到tableView对象 
cellForRowAtIndexPath //返回表格信息 
cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] 
//得到第一个分组中的第一个表格 
//indexPathForRow:0 表示表格中的每一行;indexPathForRow:n n表示第n行 
//inSection:0 表格分组;inSection:n n表示每n个分组
[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] //这里得到表格的cell,下面可以修改表格中你想修改的内容. 



http://orand.blog.163.com/blog/static/20512705020123432722305/