私は Xcode と Objective-C に本当に慣れていません。TableView にコンテンツを表示するための JSON-Array を受け取ります。
私の中で-viewDidLoad
:
[super viewDidLoad];
self.navigationItem.title = @"Kategorien";
NSURL *url = [NSURL URLWithString:@"http://www.visualstudio-teschl.at/apptest/kats.php"];
NSData *jsonData = [NSData dataWithContentsOfURL:url];
if(jsonData != nil)
{
NSError *error = nil;
_kategorien = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
}
そして私のcellForRowAtIndexPath:
方法では:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSDictionary *data = [self.kategorien objectAtIndex:indexPath.row];
cell.textLabel.text = [data objectForKey:@"KAT_NAME"];
return cell;
それはうまく機能し、テーブルに私の文字列 (キー -> KAT_NAME) を表示します。
しかし: リクエストで文字列を送信するにはどうすればよいですか? たとえば、javascript/jquery を使用した ajax-request のように、リクエストで「searchnumber = 2」を送信したいですか?
私は検索しましたが、私のニーズに対して難しすぎる (そしておそらく大きすぎる?) 例しか見つけることができませんでした...私のリクエストと「sendWithData」のような広告のような簡単な方法はありませんか、それともこの方法は私の単純なリクエストとはまったく異なりますか?