나는 일반 Newsfeed를 호출하고 무작위 공유로 적용하여 주가가 낮은 중간 증가 또는 감소하는 아이폰 게임을 만들고 있습니다. 병렬 배열을 사용하여이 문제를 해결할 것을 제안했습니다. 그게 최선의 방법인가요? 그리고 튜토리얼에 대한 유용한 링크가있는 사람이 있습니까?병렬 어레이
간단한 배열 설정이 있습니다. 하지만 x 코드가 처음인데 배열에서 항목을 호출하도록 코딩 된 코드를 가져와야합니다.
#import "NewsFeedViewController.h"
@interface NewsFeedViewController()
@end
@implementation NewsFeedViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
//Setup NSArray
items = [[NSArray alloc] initWithObjects:@"Galaxy", @"Redbull", @"Boost", nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
return items.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.textLabel.text = [items objectAtIndex:indexPath.row];
return cell;
}
@end
:
샘플 프로젝트 링크는 아래이지만,이 코드의 고기인가? 그게 좋은 출발이야, 고마워. 어레이의 무작위 세포를 어려운 과정으로 표시하고 있습니까? –