メディア事業部EC事業部 AGENCY事業部
メディア事業部ブログ

:!: :!: :!:
- (void)viewWillAppear:(BOOL)animated{

// Update the view with current data before it is displayed.
[super viewWillAppear:animated];

feedList = [[NSMutableArray alloc] initWithCapacity:0];

/*
NSString *sendUrl = @”http://coumori.test-gbleu.com/f_appli/i_area.php”;
NSURL *areaURL = [NSURL URLWithString:sendUrl];
NSError *error;
NSString *areaXml = [NSString stringWithContentsOfURL:areaURL encoding:NSUTF8StringEncoding error:&error];

NSData *areaXmlData = [areaXml dataUsingEncoding:NSUTF8StringEncoding];
*/

NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileName = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/area.xml"];
NSData *xmldData = [fileManager contentsAtPath:fileName];

NSXMLParser *nextParser = [[NSXMLParser alloc] initWithData:xmldData];

[nextParser setDelegate:self];
[nextParser parse];

// Scroll the table view to the top before it appears
[self.tableView reloadData];

}

:!: :!: :!:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {

if ([elementName compare:@"item"] == NSOrderedSame) {
currentItem = [[NSMutableDictionary alloc] initWithCapacity:0];
} else if (currentItem != NULL) {
currentContents = [[NSMutableString alloc] initWithCapacity:0];
}

}

:!: :!: :!:
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

if (currentContents && string) {

[currentContents appendString:string];
}
}

:!: :!: :!:
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

if ([elementName compare:@"item"] == NSOrderedSame) {

[feedList addObject:currentItem];
[currentItem release];
} else if (currentItem && currentContents) {
[currentItem setObject:currentContents forKey:elementName];
currentContents = nil;
[currentContents release];

}

}

:!: :!: :!:
- (void)parserDidEndDocument:(NSXMLParser *)parser {

[parser release];

}

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

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

:!: :!: :!:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @”BigCategory”;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];

//cell.selectionStyle = UITableViewCellSelectionStyleBlue;
}

if ([[feedList objectAtIndex:indexPath.row] objectForKey:@”title”]) {
cell.textLabel.text = [[feedList objectAtIndex:indexPath.row] objectForKey:@”title”];
}

//if ([[feedList objectAtIndex:indexPath.row] objectForKey:@”id”]) {
// cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//}

return cell;

}

カテゴリー:iPad, iPhone , 投稿者名:Arefin Khandoker
PAGE TOP
arefin

iPhone, Post to Php Server with Parameter

NSURL *url = [NSURL URLWithString: @"http://coumori.test-gbleu.com/f_shop/i_shop.php"];
NSString *body = [NSString stringWithFormat: @"fw=%@",searchString];

NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];
[url release];

//NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];

[urlRequest setHTTPMethod: @"POST"];
[urlRequest setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];

//[body release];

NSURLConnection *connectionResponse = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];

if (!connectionResponse)
{
NSLog(@”Failed to submit request”);
}
else
{
NSLog(@”——— Request submitted ———”);
NSLog(@”connection: %@ method: %@, encoded body: %@, body: %a”, connectionResponse, [urlRequest HTTPMethod], [urlRequest HTTPBody], body);
NSData *myReturn = [urlRequest HTTPBody];
NSLog(@”myReturn : %@”, myReturn);

NSString *errorDescription = nil;
NSPropertyListFormat format;
NSDictionary *samplePlist = [NSPropertyListSerialization propertyListFromData:myReturn mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorDescription];

NSLog(@”samplePlist : %@”, samplePlist);

NSLog(@”New connection retain count: %d”, [connectionResponse retainCount]);
NSMutableData *responseData=[[NSMutableData data] retain];
NSLog(@”response : %@”, responseData);

:!: :!: :!: :!:

WebView with Response data

NSURL *url = [NSURL URLWithString: @"http://coumori.test-gbleu.com/f_shop/i_shop.php"];
NSString *body = [NSString stringWithFormat: @"fw=%@",searchString];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
[request setHTTPMethod: @"POST"];
[request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];

[webView loadRequest: request];

カテゴリー:iPad, iPhone , 投稿者名:Arefin Khandoker
PAGE TOP
arefin

iPhone, XML Parse

In AreaViewController.h

#import
#import “UpdateViewController.h”

@interface AreaViewController : UITableViewController {

NSMutableArray *list;
NSString *area;

NSMutableArray *feedList;
NSMutableDictionary *currentItem;
NSMutableString *currentContents;

UpdateViewController *updateViewC;

}

@property (nonatomic, retain) UpdateViewController *updateViewC;

@end

:arrow: :arrow: :arrow:

In AreaViewController.m

#import “AreaViewController.h”
#import “UpdateViewController.h”

@implementation AreaViewController

@synthesize updateViewC;

- (void)viewWillAppear:(BOOL)animated{

// Update the view with current data before it is displayed.
[super viewWillAppear:animated];

feedList = [[NSMutableArray alloc] initWithCapacity:0];

NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileName = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/area.xml"];
NSData *xmldData = [fileManager contentsAtPath:fileName];

if (xmldData == nil) {
// make a alert
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@”Update” message:@”Please Update Your app.” delegate:self cancelButtonTitle:@”Cancle” otherButtonTitles:nil] autorelease];
[alert addButtonWithTitle:@"Update"];
[alert show];
}

NSXMLParser *nextParser = [[NSXMLParser alloc] initWithData:xmldData];

[nextParser setDelegate:self];
[nextParser parse];

// Scroll the table view to the top before it appears
[self.tableView reloadData];

}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {

if (buttonIndex == 1) {

// update all xml data from server
UpdateViewController *updateViewControl = [[UpdateViewController alloc]initWithNibName:@”UpdateView” bundle:[NSBundle mainBundle]];

self.updateViewC = updateViewControl ;
[updateViewControl release];

[self.navigationController pushViewController:self.updateViewC animated:YES];

}else {
// press entrt pop search scren
[self.navigationController popViewControllerAnimated:YES];
}

}

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {

if ([elementName compare:@"item"] == NSOrderedSame) {
currentItem = [[NSMutableDictionary alloc] initWithCapacity:0];
} else if (currentItem != NULL) {
currentContents = [[NSMutableString alloc] initWithCapacity:0];
}

}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

if (currentContents && string) {

[currentContents appendString:string];
}
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

if ([elementName compare:@"item"] == NSOrderedSame) {

[feedList addObject:currentItem];
[currentItem release];
} else if (currentItem && currentContents) {
[currentItem setObject:currentContents forKey:elementName];
currentContents = nil;
[currentContents release];

}

}

- (void)parserDidEndDocument:(NSXMLParser *)parser {

[parser release];

}

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

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @”BigCategory”;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];

//cell.selectionStyle = UITableViewCellSelectionStyleBlue;
}

if ([[feedList objectAtIndex:indexPath.row] objectForKey:@”title”]) {
cell.textLabel.text = [[feedList objectAtIndex:indexPath.row] objectForKey:@”title”];
}

//if ([[feedList objectAtIndex:indexPath.row] objectForKey:@”id”]) {
// cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//}

return cell;

}

#pragma mark -
#pragma mark Table view selection

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

[tableView deselectRowAtIndexPath:indexPath animated:YES];

NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileName = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/addressType.txt"];
NSString *areaString;
NSData *areaData;

switch (indexPath.row) {

case 0:

// write address type
areaString = [NSString stringWithFormat:@""];
areaData = [areaString dataUsingEncoding:NSUTF8StringEncoding];
[fileManager createFileAtPath:fileName contents:areaData attributes:nil];

//[self.navigationController popViewControllerAnimated:YES];
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];

break;

default:

// write address type
areaString = [[feedList objectAtIndex:indexPath.row] objectForKey:@”title”];
areaData = [areaString dataUsingEncoding:NSUTF8StringEncoding];
[fileManager createFileAtPath:fileName contents:areaData attributes:nil];

//[self.navigationController popViewControllerAnimated:YES];
//[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:([self.navigationController.viewControllers count] -3)] animated:YES];
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];

break;

}

}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];

// Cancle button and add an event handler
self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:@”Cancle”
style:UIBarButtonSystemItemCancel
target:self
action:@selector(handleCancle:)];
}

- (void) handleCancle:(id)sender
{
// pop the controller
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
}

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn’t have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc. that aren’t in use.
}

- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

- (void)dealloc {
[super dealloc];
[feedList release];
}

@end

カテゴリー:iPad, iPhone , 投稿者名:Arefin Khandoker
PAGE TOP

In OthersViewController.h

# import < UIKit/UIKit.h>

@interface OthersViewController : UITableViewController {

NSMutableArray *list;
NSMutableArray *sectionList;

NSIndexPath *oldIndexPath0;
int row0;
NSIndexPath *oldIndexPath1;
int row1;
NSIndexPath *oldIndexPath2;
int row2;
NSIndexPath *oldIndexPath3;
int row3;

NSString *othersString;
NSString *timeString;
NSString *pRoomString;
NSString *parkingString;
NSString *smokingString;

NSString *select0;
NSString *select1;
NSString *select2;
NSString *select3;

}

@end

In OthersViewController.m

# import “OthersViewController.h”

@implementation OthersViewController

- (void)viewWillAppear:(BOOL)animated {

// initial row by 100;
row0 = 100;
row1 = 100;
row2 = 100;
row3 = 100;

// initial strings by @”"
othersString = [NSString stringWithFormat:@""];
timeString = [NSString stringWithFormat:@""];
pRoomString = [NSString stringWithFormat:@""];
parkingString = [NSString stringWithFormat:@""];
smokingString = [NSString stringWithFormat:@""];

select0 = @”";
select1 = @”";
select2 = @”";
select3 = @”";

// Get row index
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileName = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/rowString.txt"];
NSData *rowData = [fileManager contentsAtPath:fileName];

// From NSData to NSString
NSString *rowString = [[NSString alloc] initWithData:rowData encoding:NSUTF8StringEncoding];

if (rowString) {

// spit row string
NSArray *rowArray = [rowString componentsSeparatedByString:@":"];

for (int i=0; i<[rowArray count]; i++) {

NSString *indexVal = [rowArray objectAtIndex:i];

if ([indexVal length] != 0) {

// set row value
if (i == 0) {
NSString *row0Str = [rowArray objectAtIndex:0];
row0 = [row0Str intValue];
}

if (i == 1) {
NSString *row1Str = [rowArray objectAtIndex:1];
row1 = [row1Str intValue];
}

if (i == 2) {
NSString *row2Str = [rowArray objectAtIndex:2];
row2 = [row2Str intValue];
}

if (i == 3) {
NSString *row3Str = [rowArray objectAtIndex:3];
row3 = [row3Str intValue];
}
}

}

}

// Update the view with current data before it is displayed.
[super viewWillAppear:animated];

//Initialize the array.
list = [[NSMutableArray alloc] initWithCapacity:0];
sectionList = [[NSMutableArray alloc] initWithCapacity:0];

// section header
NSArray *sectionHeaderArray = [NSArray arrayWithObjects:@"時間帯",@"個室有無",@"駐車場有無",@"喫煙可否", nil];
NSDictionary *sectionHeaderDic = [NSDictionary dictionaryWithObject:sectionHeaderArray forKey:@"section"];
[sectionList addObject:sectionHeaderDic];

// time list
NSArray *timeArray = [NSArray arrayWithObjects:@"始発まで営業",@"朝5時以降も営業",@"24時間営業", nil];
NSDictionary *timeDic = [NSDictionary dictionaryWithObject:timeArray forKey:@"time"];

// private room
NSArray *pRoomArray = [NSArray arrayWithObjects:@"こだわらない",@"有", nil];
NSDictionary *pRoomDic = [NSDictionary dictionaryWithObject:pRoomArray forKey:@"pRoom"];

// parking
NSArray *parkingArray = [NSArray arrayWithObjects:@"こだわらない",@"有[無料]",@"有[隣接有料]", nil];
NSDictionary *parkingDic = [NSDictionary dictionaryWithObject:parkingArray forKey:@"parking"];

// smoking
NSArray *smokingArray = [NSArray arrayWithObjects:@"こだわらない",@"可",@"分煙", nil];
NSDictionary *smokingDic = [NSDictionary dictionaryWithObject:smokingArray forKey:@"smoking"];

// add all dictionary to list
[list addObject:timeDic];
[list addObject:pRoomDic];
[list addObject:parkingDic];
[list addObject:smokingDic];

// Scroll the table view to the top before it appears
[self.tableView reloadData];

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

//Number of section
return [list count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

//Get the dictionary object
NSDictionary *dictionary = [list objectAtIndex:section];

NSArray *array;

switch (section) {
case 0:
// time array
array = [dictionary objectForKey:@"time"];
break;
case 1:
// pRoom array
array = [dictionary objectForKey:@"pRoom"];
break;
case 2:
// parking array
array = [dictionary objectForKey:@"parking"];
break;
case 3:
// smoking array
array = [dictionary objectForKey:@"smoking"];
break;
default:
break;
}

//Number of rows
return [array count];

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Budget";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
UITableViewCellStyleSubtitle;
}

//Get the dictionary object
NSDictionary *dictionary = [list objectAtIndex:indexPath.section];

NSArray *array;

switch (indexPath.section) {
case 0:
// time array
array = [dictionary objectForKey:@"time"];

if (indexPath.row == row0 ) {
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType = UITableViewCellAccessoryNone;
}

break;
case 1:
// pRoom array
array = [dictionary objectForKey:@"pRoom"];

if (indexPath.row == row1) {
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType = UITableViewCellAccessoryNone;
}
break;
case 2:
// parking array
array = [dictionary objectForKey:@"parking"];
if (indexPath.row == row2) {
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType = UITableViewCellAccessoryNone;
}
break;
case 3:
// smoking array
array = [dictionary objectForKey:@"smoking"];
if (indexPath.row == row3) {
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
cell.accessoryType = UITableViewCellAccessoryNone;
}
break;
default:
break;
}

cell.textLabel.text = [array objectAtIndex:indexPath.row];

NSLog(@"index cell");

return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

NSString *title = nil;

//Get the dictionary object
NSDictionary *dictionary = [sectionList objectAtIndex:0];
NSArray *array = [dictionary objectForKey:@"section"];
title = [array objectAtIndex:section];

return title;
}

#pragma mark -
#pragma mark Table view selection

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];

switch(indexPath.section)
{
case 0:
{

UITableViewCell *cell1 = [tableView cellForRowAtIndexPath:indexPath];

if ([[tableView cellForRowAtIndexPath:indexPath ] accessoryType] == UITableViewCellAccessoryCheckmark) {

cell1.accessoryType = UITableViewCellAccessoryNone;
row0 = 100;
timeString = @"";

}else {

NSIndexPath *SIndexPath0 = [NSIndexPath indexPathForRow:row0 inSection:0];

if ([[tableView cellForRowAtIndexPath:SIndexPath0 ] accessoryType] == UITableViewCellAccessoryCheckmark) {

[[tableView cellForRowAtIndexPath:SIndexPath0] setAccessoryType:UITableViewCellAccessoryNone];

}

if (oldIndexPath0 == nil) {
oldIndexPath0 = indexPath;
}

UITableViewCell *cell2 = nil;
if (oldIndexPath0 != indexPath) {
cell2 = [tableView cellForRowAtIndexPath:oldIndexPath0];
}

cell1.accessoryType = UITableViewCellAccessoryCheckmark;
if (cell2) {
cell2.accessoryType = UITableViewCellAccessoryNone;
}

//Get the dictionary object
NSDictionary *dictionary = [list objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"time"];
timeString = [array objectAtIndex:indexPath.row];

row0 = indexPath.row;
oldIndexPath0 = indexPath;
}

select0 = @"marked";

break;

}
case 1:
{

UITableViewCell *cell1 = [tableView cellForRowAtIndexPath:indexPath];

if ([[tableView cellForRowAtIndexPath:indexPath ] accessoryType] == UITableViewCellAccessoryCheckmark) {

cell1.accessoryType = UITableViewCellAccessoryNone;
row1 = 100;
pRoomString = @"";

}else {

NSIndexPath *SIndexPath1 = [NSIndexPath indexPathForRow:row1 inSection:1];

if ([[tableView cellForRowAtIndexPath:SIndexPath1 ] accessoryType] == UITableViewCellAccessoryCheckmark) {

[[tableView cellForRowAtIndexPath:SIndexPath1] setAccessoryType:UITableViewCellAccessoryNone];

}

if (oldIndexPath1 == nil) {
oldIndexPath1 = indexPath;
}

UITableViewCell *cell2 = nil;
if (oldIndexPath1 != indexPath) {
cell2 = [tableView cellForRowAtIndexPath:oldIndexPath1];
}

cell1.accessoryType = UITableViewCellAccessoryCheckmark;
if (cell2) {
cell2.accessoryType = UITableViewCellAccessoryNone;
}

//Get the dictionary object
NSDictionary *dictionary = [list objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"pRoom"];
pRoomString = [array objectAtIndex:indexPath.row];

row1 = indexPath.row;

oldIndexPath1 = indexPath;
}

select1 = @"marked";

break;

}
case 2:
{

UITableViewCell *cell1 = [tableView cellForRowAtIndexPath:indexPath];

if ([[tableView cellForRowAtIndexPath:indexPath ] accessoryType] == UITableViewCellAccessoryCheckmark) {

cell1.accessoryType = UITableViewCellAccessoryNone;
row2 = 100;
parkingString = @"";

}else {

NSIndexPath *SIndexPath2 = [NSIndexPath indexPathForRow:row2 inSection:2];

if ([[tableView cellForRowAtIndexPath:SIndexPath2 ] accessoryType] == UITableViewCellAccessoryCheckmark) {

[[tableView cellForRowAtIndexPath:SIndexPath2] setAccessoryType:UITableViewCellAccessoryNone];

}

if (oldIndexPath2 == nil) {
oldIndexPath2 = indexPath;
}

UITableViewCell *cell2 = nil;
if (oldIndexPath2 != indexPath) {
cell2 = [tableView cellForRowAtIndexPath:oldIndexPath2];
}

cell1.accessoryType = UITableViewCellAccessoryCheckmark;
if (cell2) {
cell2.accessoryType = UITableViewCellAccessoryNone;
}

//Get the dictionary object
NSDictionary *dictionary = [list objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"parking"];
parkingString = [array objectAtIndex:indexPath.row];

row2 = indexPath.row;

oldIndexPath2 = indexPath;

}

select2 = @"marked";

break;
}

case 3:
{

UITableViewCell *cell1 = [tableView cellForRowAtIndexPath:indexPath];

if ([[tableView cellForRowAtIndexPath:indexPath ] accessoryType] == UITableViewCellAccessoryCheckmark) {

cell1.accessoryType = UITableViewCellAccessoryNone;
row3 = 100;
smokingString = @"";

}else {

NSIndexPath *SIndexPath3 = [NSIndexPath indexPathForRow:row3 inSection:3];

if ([[tableView cellForRowAtIndexPath:SIndexPath3 ] accessoryType] == UITableViewCellAccessoryCheckmark) {

[[tableView cellForRowAtIndexPath:SIndexPath3] setAccessoryType:UITableViewCellAccessoryNone];

}

if (oldIndexPath3 == nil) {
oldIndexPath3 = indexPath;
}

UITableViewCell *cell2 = nil;
if (oldIndexPath3 != indexPath) {
cell2 = [tableView cellForRowAtIndexPath:oldIndexPath3];
}

cell1.accessoryType = UITableViewCellAccessoryCheckmark;
if (cell2) {
cell2.accessoryType = UITableViewCellAccessoryNone;
}

//Get the dictionary object
NSDictionary *dictionary = [list objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"smoking"];
smokingString = [array objectAtIndex:indexPath.row];

row3 = indexPath.row;
oldIndexPath3 = indexPath;

}

select3 = @"marked";

break;
}

default:
break;
}

}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];

// Cancle button and add an event handler
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:@"Cancle"
style:UIBarButtonSystemItemCancel
target:self
action:@selector(handleCancle:)];

// Cancle button and add an event handler
self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:@"Use"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(handleUse:)];

}

- (void) handleCancle:(id)sender
{
// pop the controller
[self.navigationController popViewControllerAnimated:YES];
}

- (void) handleUse:(id)sender{

NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileName;

// Get row index value
fileName = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/othersString.txt"];
NSData *rowValData = [fileManager contentsAtPath:fileName];

// From NSData to NSString
NSString *rowValString = [[NSString alloc] initWithData:rowValData encoding:NSUTF8StringEncoding];

NSString *oldTimeString = @"";
NSString *oldpRoomString = @"";
NSString *oldParkingString = @"";
NSString *oldSmokingString = @"";

if (rowValString) {
// spit row string
NSArray *rowValArray = [rowValString componentsSeparatedByString:@":"];

for (int i=0; i<[rowValArray count]; i++) {

if ([rowValArray objectAtIndex:i] != @"") {

// set row value
if (i == 0 ) {
oldTimeString = [rowValArray objectAtIndex:0];
}

if (i == 1 ) {
oldpRoomString = [rowValArray objectAtIndex:1];
}

if (i == 2 ) {
oldParkingString = [rowValArray objectAtIndex:2];
}

if (i == 3) {
oldSmokingString = [rowValArray objectAtIndex:3];
}
}

}

}

if (select0 == @"") {
timeString = oldTimeString;
}

if (select1 == @"") {
pRoomString = oldpRoomString;
}

if (select2 == @"") {
parkingString = oldParkingString;
}

if (select3 == @"") {
smokingString = oldSmokingString;
}

// make othersString string
othersString = [NSString stringWithFormat:@"%@:%@:%@:%@", timeString, pRoomString, parkingString, smokingString];

// write othersString to othersString.txt file
fileName= [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/othersString.txt"];
NSData *othersData = [othersString dataUsingEncoding:NSUTF8StringEncoding];
[fileManager createFileAtPath:fileName contents:othersData attributes:nil];

// make row data in string
NSString *rowString = [NSString stringWithFormat:@"%i:%i:%i:%i", row0,row1,row2,row3];

// write othersString to othersString.txt file
fileName = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp/rowString.txt"];
NSData *rowData = [rowString dataUsingEncoding:NSUTF8StringEncoding];
[fileManager createFileAtPath:fileName contents:rowData attributes:nil];

// pop the controller
[self.navigationController popViewControllerAnimated:YES];

}

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

- (void)dealloc {
[super dealloc];
[list release];
}

@end

カテゴリー:iPad, iPhone , 投稿者名:Arefin Khandoker
PAGE TOP
kawasaki

Chrome Music Mixer

最近TVで流れてるGoogleのCMがどれも楽しそうで

なんだか気になります。

CM一覧 ここで見れます

 

特に、金髪の女性が街中でyoutubeを使ってパフォーマンスするCM。

あれ、最初見たとき

「なんでこんなぴったり合わせられるの!?」

って関係ないとこ(?)が気になったり。

 

で、あれと同じようなことができるコンテンツがちゃんとありました。

 

Chrome Music Mixer

(*ちなみにスピーカーONにしてないと意味ないです)

 

試しに「ハッピーバースデー」を自分宛に作ってみました。

 

音楽センスまったくないですが

出来上がったものを最後まで聞いて(見て)みたら

なんだかニヤリとしちゃいましたよ。

 

こういうちょっとHappyになれるコンテンツっていいですね。

カテゴリー:サイト紹介 , 投稿者名:nami kawasaki
PAGE TOP

Add CoreLocation.framework from existing framework

Then import CoreLocation header and write like locationController.h

#import < UIKit/UIKit.h >
#import < CoreLocation/CoreLocation.h >

@interface locationController : UIViewController {

CLLocationManager *locationManager;

}

@property (nonatomic, retain) CLLocationManager *locationManager;

@end

Then go to your locationController.m and write like

#import “locationController.h”

@implementation locationController

@synthesize locationManager;

Then search viewDidLoad and write like

- (void)viewDidLoad { [super viewDidLoad];

// locationManager update as location locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager startUpdatingLocation];

CLLocation *location = [locationManager location];

// Configure the new event with information from the location. CLLocationCoordinate2D coordinate = [location coordinate];

NSString *latitude = [NSString stringWithFormat:@"%f", coordinate.latitude]; NSString *longitude = [NSString stringWithFormat:@"%f", coordinate.longitude];

NSLog(@”dLatitude : %@”, latitude); NSLog(@”dLongitude : %@”,longitude);

}

You can check latitude longitude on your console log. Enjoy….

カテゴリー:iPad, iPhone , 投稿者名:Arefin Khandoker
PAGE TOP
kawasaki

厄払いのススメ

あけましてもう2週間近く経つのですね、、、早い、、、。

 

三が日は風邪で寝こんで一歩も外には出られず、

こりゃ2011年、なんかあるぞと思っていたら

どうやら今年は厄年(しかも本厄)らしいです。ぎゃふん!

で、早速ウチノさんおすすめの神社に厄払いに行ってまいりました。

 

大杉神社

大杉神社

ホームページが華やかで、なんだかご利益ありそうなんですが

何よりも、いきなり始まるムービーがいろんな意味でヤバイです。

 

この神社は、願い事を叶える「夢むすび」というのがイチオシらしいです。

厄払いをしてもらったあと、ついでにと言っちゃあなんですが

夢を叶えてもらえる輪っかをぐるぐるとくぐって帰ってきました。

 

輪っか

 

この輪っかを八の字にぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐるぐ

(ホントは3回でいいらしいです)

 

 

これで今年はもう大丈夫ですね。

カテゴリー:その他, サイト紹介 , 投稿者名:nami kawasaki
PAGE TOP

NASA has discovered the smallest planet ever seen beyond our solar system – a rocky world just 1.4 times larger than Earth – using its planet-hunting Kepler observatory.

The planet, called Kepler-10b, is also the first rocky alien planet to be confirmed by NASA’s Kepler mission using data collected between May 2009 and early January 2010. But, while Kepler-10b is a rocky world, it is not located in the so-called habitable zone – a region in a planetary system where liquid water can potentially exist on the planet’s surface.

“Kepler-10b is the smallest exoplanet discovered to date, and the first unquestionably rocky planet orbiting a star outside our solar system,” said Natalie Batalha, Kepler’s deputy science team leader at NASA’s Ames Research Center in Moffett Field, Calif., at a press conference here at the 217th American Astronomy

カテゴリー:その他 , 投稿者名:Arefin Khandoker
PAGE TOP
arefin

AdblockPlus

Adblock Plus is a free extension for Firefox that strips adverts from web-pages. This video shows you how it works, how to install it, uninstalling it and getting help – all in just over a minute.
The extension is available from http://AdblockPlus.org we produced this video because we’re long-time users of Adblock Plus and Firefox and we wanted to do some open-source advocacy.
We also wanted to help Wladimir (author) explain the extension to more users, especially those without Firefox experience.
Produced by http://ProCasts.co.uk

AdblockPlus Add Ons

カテゴリー:その他 , 投稿者名:Arefin Khandoker
PAGE TOP

先日お知らせしました、現在「たびすまいる」で公開中のNHK大河ドラマ「江~姫たちの戦国」特別展特集ですが、この特集を執筆して頂いた歴女ライターのジャスミン大久保さんが、来る

2011年1月1日、元旦、
NHKラジオ
21:30~23:00時放送のお正月特番
歴女たちの関ヶ原

に出演します!!!

番組HPはこちら→ http://www.nhk.or.jp/radiosp/rekijyo/

一日と言えば、初詣も終えて、残す正月休みをどう過ごそうかこたつでごろごろしているのではないでしょうか?
大河ドラマの予習としてこの番組もかなりお勧めです!
江について歴女ライターが熱いバトル(?)を繰り広げます!

私はというと・・・今日は午後から江戸東京博物館で開催される特別展「江~姫たちの戦国」の内覧会に参加してきます!
戻りましたら特集ページのクイズページを公開予定です!

このクイズ、正解者の中から抽選でアマゾンギフト券5000円が当たります!

ぜひぜひお見逃しなく!!

カテゴリー:activity, その他 , 投稿者名:reina uchiyama
PAGE TOP
ページトップへ