IOS APP DEVELOPMENT
Thursday, 21 February 2013
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
Wednesday, 20 February 2013
IOS BASICS EXPLINATIONS BY NAVEENRAJU
JSon IN Table View
Code For Above Demo:
MasterViewController.h
//
// MasterViewController.h
// Table_JsonDemo
//
// Created by apple on 19/02/13.
// Copyright (c) 2013 apple. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MasterViewController : UITableViewController
{
}
@property(nonatomic,retain)NSURL *jsonUrl;
@property(nonatomic,retain)NSString *jsonData;
@property(nonatomic,retain)NSMutableArray *jsonArray;
@end
MasterViewController.m
//
// MasterViewController.m
// Table_JsonDemo
//
// Created by apple on 19/02/13.
// Copyright (c) 2013 apple. All rights reserved.
//
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "SBJson.h"
@interface MasterViewController () {
NSMutableArray *_objects;
}
@end
@implementation MasterViewController
@synthesize jsonArray;
@synthesize jsonData;
@synthesize jsonUrl;
- (void)viewDidLoad
{
[super viewDidLoad];
self.title=@"Jon Data IN TableView";
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];
//NSDate *object = _objects[indexPath.row];
cell.textLabel.text = [self.jsonArray objectAtIndex:indexPath.row];
return cell;
}
@end
ViewController.xib
HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN IOS CREATED BY NAVEENRAJU
DataBase Insertion
code For Above Demo:
ViewController.h
//
// ViewController.h
// InsertMysql_Registration
//
// Created by apple on 19/02/13.
// Copyright (c) 2013 apple. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *t1;
@property (strong, nonatomic) IBOutlet UITextField *t2;
@property (strong, nonatomic) IBOutlet UITextField *t3;
- (IBAction)Register:(id)sender;
- (IBAction)delete:(id)sender;
@end
ViewController.m
//
// ViewController.m
// InsertMysql_Registration
//
// Created by apple on 19/02/13.
// Copyright (c) 2013 apple. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize t1;
@synthesize t2;
@synthesize t3;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)Register:(id)sender {
NSString *url=[NSString stringWithFormat:@"http://localhost/App1/Registration.php?name=%@&age=%@&sex=%@",t1.text,t2.text,t3.text];
//To exicute php code
NSData *dataUrl=[NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
}
- (IBAction)delete:(id)sender {
NSString *url1=[NSString stringWithFormat:@"http://localhost/App1/Delete.php"];
//To exicute php code
NSData *dataUrl1=[NSData dataWithContentsOfURL:[NSURL URLWithString:url1]];
}
@end
ViewController.xib
Registration.php
<?php
//create data base connections
$user='root';
$pswd='';
$db='iosproj';
$conn=mysql_connect('localhost',$user,$pswd);
mysql_select_db($db,$conn);
//if name,age,sex are seted then only values are inserted
if (isset($_GET['name']) && isset($_GET['age']) && isset($_GET['sex']))
{
$name=$_GET['name'];
$age=$_GET['age'];
$sex=$_GET['sex'];
$result=mysql_query("insert into Register(name
,age,sex)values('$name','$age','$sex')");
}
?>
Delete.php
<?php
//create data base connections
$user='root';
$pswd='';
$db='iosproj';
$conn=mysql_connect('localhost',$user,$pswd);
mysql_select_db($db,$conn);
$result=mysql_query("delete from Register");
?>
PHPMYADMIN:
Monday, 18 February 2013
IOS BASICS EXPLINATIONS BY NAVEENRAJU
Responsive Design By Using "Media Quaries" in IOS
->Responsive web Design is possible by using css3 Media Quaries->We can have 1 style sheet for large diplays and diff styles specify for mobiles based on resulution,pixelsizes->it will allow diff resolutions with out changing the content
MediaQuaryDemo.html
<!Doctype Html><head>
<link rel="stylesheet" type="text/css" href="Media.css" />
</head><body>
<div id="naveen"><img src="grails.jpg"></div>
<div id="left">
Android Blog
</div>
<div id="right">IOs Blog
</div>
</body></html>
Media.css
#container{
width: :600px;margin-right: automargin-left:auto;}
#left {
width:70%;height: 200px;float:left;background:red;}
#right{
width:30%;height: 200px;float:right;background:cyan;}
img{width: 30%;}
@media screen and (max-width: 590px) {
#container{
width: :600px;margin-right: automargin-left:auto;}
#left {
width:70%;height: 200px;float:left;background:orange;}
#right{
width:30%;height: 200px;float:right;background:blue;}
img{width: 30%;}
}
ViewController.h
//// ViewController.h// MediaQuary//// Created by apple on 18/02/13.// Copyright (c) 2013 apple. All rights reserved.//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
IBOutlet UIWebView *webview; IBOutlet UIWebView *web;}
@property(nonatomic,retain) UIWebView *webview;@property (strong, nonatomic) IBOutlet UIWebView *web;
//@property(nonatomic,retain) UIWebView *webview1
@end
ViewController.m
//// ViewController.m// MediaQuary//// Created by apple on 18/02/13.// Copyright (c) 2013 apple. All rights reserved.//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController@synthesize webview;- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib. NSString *path=[[NSBundle mainBundle]pathForResource:@"MediaQuaryDemo" ofType:@"html"inDirectory:@""]; NSURL *url=[NSURL fileURLWithPath:path]; NSURLRequest *request=[NSURLRequest requestWithURL:url]; [webview loadRequest:request];
}
- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}
@end
HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN IOS CREATED BY NAVEENRAJU
IOS BASICS EXPLINATIONS BY NAVEENRAJU
OBJECTIVE C
Arrays and StructuresArrays
In Single Variabule we can hold many diff values
They are two types of Array 1}ImmutabuleArray(NSArray) 2)MutableArray(NSMutabuleArray) code for Array:
//
|
Subscribe to:
Posts (Atom)