スクロールビューに4つのUITableViewを追加し、それらにいくつかの異なる配列を入力したいと思います(たとえば、それぞれに1つの配列があるとします)。このスクロールビューも自分に追加しましたself.view
(UIViewControllerクラスでこれを行います)。テーブルビューにデータを入力するにはどうすればよいですか?
詳細:
これがスクリーンショットです。
これが私の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..
これらのテーブルビューにさまざまな配列を入力したいのですが、この状況を処理する方法は..?どうもありがとう
追記; 私はこのようなことを試しましたが、効果はありませんでした:
- (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;
}