Wednesday, February 16, 2011

DEALING WITH NULL SQL DATABASE

#pragma mark DEALING WITH NULL SQL DATABASE

char *currencyChars = (char *)sqlite3_column_text(compiledStatement, 3);


if (currencyChars !=NULL)
aFAQ.img = [NSString stringWithUTF8String: currencyChars];

Dynamic display of button from sql

for (NSString *arrayString in appDelegate.saveTCellImg )
{

k++;
CGRect frame = CGRectMake(curXLoc, curYLoc, 60, 50);
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = frame;
UIImage *theImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[ NSURL URLWithString:arrayString]]];




NSLog(@" BUTTON INDEX IS = %d",k);




button.tag=k;//[arrayString intValue];
rowID=k;



[button setImage:theImage forState:UIControlStateNormal];
//[button setImage:[UIImage imageNamed:[appDelegate.saveTCellImg objectAtIndex:0]] forState:UIControlStateNormal];
[button setTitle:(NSString *)[appDelegate.a1 objectAtIndex:k] forState:(UIControlState)UIControlStateNormal];
[button addTarget:self action:@selector(buttonEvent: ) forControlEvents:UIControlEventTouchUpInside];



curXLoc +=60;// (kScrollObjWidth1);


if(curXLoc>=200)
{

curXLoc=20;
curYLoc+=150;
}


NSLog(@" WIDTH IS %d",curXLoc);
// NSLog(@" WIDTH IS %d",kScrollObjWidth1);



[self.view addSubview:button];

}

FEEDJIT Live