Thursday, March 24, 2011

set default zoom level in UIScrollview

- (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];

}

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()"];
}
}

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);

Tuesday, March 8, 2011

ipad run

inseret this ti info.plost


NSMainNibFile~ipad


http:// www . devx.com/wireless/Article/44472/1763/page/2

FEEDJIT Live