一般的なニュースフィードを呼び出してランダムなシェアを適用し、低中または高の増減で株価に影響を与える iPhone ゲームを作成しています。これを行うために並列配列を使用することが提案されました。それが最善の方法ですか?そして、その方法についてのチュートリアルへの便利なリンクを誰かが持っていますか?
私は単純な配列の設定をしています。しかし、私は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