我想在我的滚动视图上添加 4 个 UITableView 并用一些不同的数组填充它们(假设我每个都有一个数组)。我也将此滚动视图添加到我的self.view
(我在 UIViewController 类上执行此操作)。我如何填充我的 Tableviews 任何人都可以帮忙吗?
更多细节:
这是一个屏幕截图;
这是我的 UIViewControllerClass 的界面
#import <UIKit/UIKit.h>
@interface MainMenu : UIViewController<UITableViewDelegate>
@property (retain, nonatomic) IBOutlet UIScrollView *scrollView;
@property (retain, nonatomic) IBOutlet UITableView *group1;
@property (retain, nonatomic) IBOutlet UITableView *group2;
@property (retain, nonatomic) IBOutlet UITableView *group3;
@property (retain, nonatomic) IBOutlet UITableView *group4;
@end//i drag/dropped from IB, so there is no problem with synthesizes..
我想用不同的数组填充这些 tableview,如何处理这种情况..?非常感谢
附加说明;我尝试了这样的事情但没有效果:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [group1 dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSArray *array=[NSArray arrayWithObjects:@"one",@"two",@"tree", nil];
cell.textLabel.text = [array objectAtIndex:indexPath.row];
return cell;
}