2013-05-10 89 views
0

我想创建一个包含多列的表视图,我想为不同的主题显示每个学生标记。在ios 4,5和6中有多个列的表视图

我google了一下,但没有找到我需要的确切解决方案。我确实发现了一些被破坏的链接。我想要像确切的网格视图,即按行分隔的列的tableview。请给我一些想法。

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
    } 

在上面的方法中写什么?我想要这个作为我的主视图控制器的子视图。

我跟着这个链接:How to display multiple columns in a UITableView?

,但我是很新的Objective-C的,所以请指导我如何在IB定义自定义单元格

谢谢

回答

1

我认为你需要这样设置的tableview风格...

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID] autorelease]; 

有可用不同的风格...

UITableViewCellStyleDefault, // Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x) 
UITableViewCellStyleValue1,  // Left aligned label on left and right aligned label on right with blue text (Used in Settings) 
UITableViewCellStyleValue2,  // Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts) 
UITableViewCellStyleSubtitle // Left aligned label on top and left aligned label on bottom with gray text (Used in iPod). 

希望这会有所帮助!

干杯!

+0

你可以给我任何对我的需求有用的链接 – siva 2013-05-10 13:21:40

+0

你保存了我的一天,我打算用单元格内的自定义视图来完成,不知道添加两个标签是如此简单。谢谢! – 2013-05-22 06:40:36