에서 tableviews을 채우는 방법 (의 내가 각각 하나 개의 배열이 있다고 가정하자). 나는이 scrollview를 내 self.view
에 추가했다. (UIViewController 클래스에서이 일을한다.) 아무도 도와 줄 수있는 내 Tableviews 채울 수 있습니까?의 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..
내가 다른 배열과 함께이있는 tableview을 채우려 어떻게이 상황을 처리하는 것입니다 ..? 덕분에 많은
추가 참고; .. 그 후 각 테이블에 대해 다른 태그를 할당합니다, 먼저 4 개 테이블의 UIViewController에 드 위임 및 데이터 소스를 만들 것입니다,
- (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;
}
당신은 인터페이스에서 데이터 소스를 입력하지 않은 당신은 또한 방법을 구현해야합니다 : - (NSInteger)있는 tableView : (jQuery과 *)있는 tableView numberOfRowsInSection : (NSInteger) 섹션; – WhiteTiger