Thursday, 21 February 2013




HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN IOS CREATED BY NAVEENRAJU



IOS BASICS EXPLINATIONS BY NAVEENRAJU


Print JSON Values In  Command Line










code for Above Demo:


ViewController.h



//
//  ViewController.h
//  JsonDemo
//
//  Created by apple on 19/02/13.
//  Copyright (c) 2013 apple. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{}
@property(nonatomic,retain)NSString *jsonData;@property(nonatomic,retain)NSURL *jsonUrl;@property(nonatomic,retain)NSMutableArray *jsonArray;



@end







ViewController.m


//
//  MasterViewController.m
//  JSONDEMO
//l
//  Created by appe on 08/02/13.
//  Copyright (c) 2013 apple. All rights reserved.
//


#import "ViewController.h"
#import "SBJson.h"
#import "JsonDemo-Prefix.pch"
@interface ViewController () {    NSMutableArray *_objects;
}
@end
@implementation ViewController
@synthesize jsonUrl;@synthesize jsonArray;
@synthesize jsonData;
- (void)viewDidLoad
{
    [super viewDidLoad];  
    self.title=@"JsonDemo";  
    jsonUrl=[NSURL URLWithString:@"http://localhost/App1/rac.php"];    jsonData =[[NSString alloc]initWithContentsOfURL:jsonUrl];    self.jsonArray=[jsonData JSONValue];    NSLog(@"%@",jsonArray);  
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [jsonArray count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];  
  
    cell.textLabel.text = [self.jsonArray objectAtIndex:indexPath.row];
  
    return cell;
}
@end



MainStoryboard.storyboard











No comments:

Post a Comment