- (void)viewDidLoad {
imageView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"KK_Map-02.jpg"]];
//self.imageView = imageView;
//[tempImageView release];
[super viewDidLoad];
//aWw.delegate = self;
//[scrollView setUserInteractionEnabled:YES];
scrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height);//imageView.frame.size.width*9.6, imageView.frame.size.height*0.9
//scrollView.contentOffset = CGPointMake(imageView.frame.size.width/4,
// imageView.frame.size.height/4);
//CGRect rect = CGRectMake(119, 42, 208, 166);
scrollView.maximumZoomScale = 4.0;
scrollView.minimumZoomScale = 0.33;
scrollView.clipsToBounds = YES;
scrollView.delegate = self;
scrollView.bouncesZoom=FALSE;
[scrollView addSubview:imageView];
float minimumScale = [scrollView frame].size.width / [imageView frame].size.width;
[scrollView setMinimumZoomScale:minimumScale];
[scrollView setZoomScale:minimumScale];
}
Thursday, March 24, 2011
Monday, March 14, 2011
JS to Obj-c and Objc to JS
search for text which you can to test against
- (BOOL)webView:(UIWebView *)localwebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
NSString *path = [[request URL] path];
NSString *pathTrimmed = [path lastPathComponent];
NSLog(@"sfdf %@",url);
NSLog(@"path f %@",pathTrimmed);
if ([pathTrimmed isEqualToString:@"Reset"]) {
// Display alert
UIAlertView *alertb = [[UIAlertView alloc] initWithTitle:@"You want to Reset Data??" message:@"" delegate:self cancelButtonTitle:@"No" otherButtonTitles: @"YES",nil];
alertb.tag=3;
[alertb show];
[alertb release];
return NO;
}
return YES;
}
and then based on alert call JS Function defined in html page
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex == 1) {
//NSLog(@" its done now uplaod data");
[localwebView stringByEvaluatingJavaScriptFromString:@"confirmation()"];
}
}
- (BOOL)webView:(UIWebView *)localwebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
NSString *path = [[request URL] path];
NSString *pathTrimmed = [path lastPathComponent];
NSLog(@"sfdf %@",url);
NSLog(@"path f %@",pathTrimmed);
if ([pathTrimmed isEqualToString:@"Reset"]) {
// Display alert
UIAlertView *alertb = [[UIAlertView alloc] initWithTitle:@"You want to Reset Data??" message:@"" delegate:self cancelButtonTitle:@"No" otherButtonTitles: @"YES",nil];
alertb.tag=3;
[alertb show];
[alertb release];
return NO;
}
return YES;
}
and then based on alert call JS Function defined in html page
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex == 1) {
//NSLog(@" its done now uplaod data");
[localwebView stringByEvaluatingJavaScriptFromString:@"confirmation()"];
}
}
Thursday, March 10, 2011
check inernet conection on iphone
NSString *connected = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.google.com"]];
//NSLog(@" SRRINF IS %@",connected);
wait(20);
if (connected == NULL) {
NSLog(@"Not connected");
UIAlertView *alertb = [[UIAlertView alloc] initWithTitle:@"Internet is down " message:@"Check your internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil,nil];
[alertb show];
[alertb release];
} else {
NSLog(@"Connected - %@",connected);
//NSLog(@" SRRINF IS %@",connected);
wait(20);
if (connected == NULL) {
NSLog(@"Not connected");
UIAlertView *alertb = [[UIAlertView alloc] initWithTitle:@"Internet is down " message:@"Check your internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil,nil];
[alertb show];
[alertb release];
} else {
NSLog(@"Connected - %@",connected);
Tuesday, March 8, 2011
ipad run
inseret this ti info.plost
NSMainNibFile~ipad
http:// www . devx.com/wireless/Article/44472/1763/page/2
NSMainNibFile~ipad
http:// www . devx.com/wireless/Article/44472/1763/page/2
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];
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];
}
{
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];
}
Thursday, January 27, 2011
Sunday, January 23, 2011
add button to UItableview cell
myButton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton1.frame = CGRectMake(0, 20, 80, 30); // position in the parent view and set the size of the button
[myButton1 setTitle:@"MAIL!" forState:UIControlStateNormal];
// add targets and actions
[myButton1 addTarget:self action:@selector(buttonClicked1:) forControlEvents:UIControlEventTouchUpInside];
// add to a view
//[self addSubview:myButton];
myButton1.tag=jk;//indexPath.row;
//[self.view addSubview:myButton];
[cell.contentView addSubview:myButton1];
/// ADDING METHOD TO THOS BUTTONS
- (IBAction)buttonWasPressed:(id)sender
{
NSIndexPath *indexPath =
[self.myTableView
indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
NSUInteger row = indexPath.row;
// Do something with row index
}
myButton1.frame = CGRectMake(0, 20, 80, 30); // position in the parent view and set the size of the button
[myButton1 setTitle:@"MAIL!" forState:UIControlStateNormal];
// add targets and actions
[myButton1 addTarget:self action:@selector(buttonClicked1:) forControlEvents:UIControlEventTouchUpInside];
// add to a view
//[self addSubview:myButton];
myButton1.tag=jk;//indexPath.row;
//[self.view addSubview:myButton];
[cell.contentView addSubview:myButton1];
/// ADDING METHOD TO THOS BUTTONS
- (IBAction)buttonWasPressed:(id)sender
{
NSIndexPath *indexPath =
[self.myTableView
indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
NSUInteger row = indexPath.row;
// Do something with row index
}
Tuesday, January 18, 2011
color UI title sectionview
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 44.0;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// create the parent view that will hold header Label
UIView* customView = [[[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 150.0, 44.0)]autorelease];
NSString *sectionName = nil;
switch(section)
{
case 0:
if(counter<=3)
NSLog(@"ok");
// create the buNSLog(@"ok");tton object
UILabel * headerLabel = [[[UILabel alloc] initWithFrame:CGRectZero]autorelease] ;
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:20];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);
// If you want to align the header text as centered
// headerLabel.frame = CGRectMake(150.0, 0.0, 300.0, 44.0);
headerLabel.text = @"Description"; // i.e. array element
[customView addSubview:headerLabel];
if(counter==7)
headerLabel.text = @""; // i.e. array element
[customView addSubview:headerLabel];
//sectionName = @"DES-";
break;
case 1:
{
return 44.0;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// create the parent view that will hold header Label
UIView* customView = [[[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 150.0, 44.0)]autorelease];
NSString *sectionName = nil;
switch(section)
{
case 0:
if(counter<=3)
NSLog(@"ok");
// create the buNSLog(@"ok");tton object
UILabel * headerLabel = [[[UILabel alloc] initWithFrame:CGRectZero]autorelease] ;
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:20];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);
// If you want to align the header text as centered
// headerLabel.frame = CGRectMake(150.0, 0.0, 300.0, 44.0);
headerLabel.text = @"Description"; // i.e. array element
[customView addSubview:headerLabel];
if(counter==7)
headerLabel.text = @""; // i.e. array element
[customView addSubview:headerLabel];
//sectionName = @"DES-";
break;
case 1:
Sunday, January 16, 2011
Avoid shuffling of data in UITABLE Section view
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier=nil ;
NSMutableArray *Array= [[[NSMutableArray alloc] initWithObjects: @"One",@"Two", @"Three",@"Ad",@"Ae",@"Ah",@"Aj" ,nil]autorelease];
CellIdentifier = [Array objectAtIndex:indexPath.section];
///302-1021-9244-4658-1994-3384
UITableViewCell * cell = [tabelView dequeueReusableCellWithIdentifier:CellIdentifier];
//number++;
// NSLog(@" NUMBER IS %d",number);
// if (cell != nil)
//if(number==1);
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
// // Set up the cell
appDelegate = (DatabaseTestAppDelegate *)[[UIApplication sharedApplication] delegate];
switch(indexPath.section)
{
}
}
NSString *CellIdentifier=nil ;
NSMutableArray *Array= [[[NSMutableArray alloc] initWithObjects: @"One",@"Two", @"Three",@"Ad",@"Ae",@"Ah",@"Aj" ,nil]autorelease];
CellIdentifier = [Array objectAtIndex:indexPath.section];
///302-1021-9244-4658-1994-3384
UITableViewCell * cell = [tabelView dequeueReusableCellWithIdentifier:CellIdentifier];
//number++;
// NSLog(@" NUMBER IS %d",number);
// if (cell != nil)
//if(number==1);
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
// // Set up the cell
appDelegate = (DatabaseTestAppDelegate *)[[UIApplication sharedApplication] delegate];
switch(indexPath.section)
{
}
}
Subscribe to:
Posts (Atom)