Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // infopage.m
- // BarCodeApp
- //
- // Created by jahangir nawaz on 10/21/11.
- // Copyright 2011 __MyCompanyName__. All rights reserved.
- //
- #import "infopage.h"
- #import "BarCodeAppViewController.h"
- @implementation infopage
- @synthesize header;
- @synthesize homeurl;
- @synthesize hometext;
- @synthesize barcodeurl;
- @synthesize barcodetext;
- @synthesize gpslabel;
- @synthesize sw;
- @synthesize done;
- @synthesize locationLabel;
- @synthesize locationSwitch;
- @synthesize locationstr;
- @synthesize str;
- // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- /*
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization.
- }
- return self;
- }
- */
- /*
- // Implement loadView to create a view hierarchy programmatically, without using a nib.
- - (void)loadView {
- }
- */
- -(void)viewWillAppear:(BOOL)animated{
- }
- // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- - (void)viewDidLoad {
- NSLog(@"i am here")
- [super viewDidLoad];
- self.view.backgroundColor = [UIColor lightGrayColor];
- ///////////////////////header///////////////////////////
- header=[[UILabel alloc]initWithFrame:CGRectMake(10, 5, 300, 40)];
- [header setBackgroundColor:[UIColor clearColor]];
- [header setFont:[UIFont fontWithName:@"Helvetica-Bold" size:18 ]];
- [header setText: @"Enter the information provided by your webmaster below:"];
- [header setTextColor:[UIColor blueColor]];
- [header setLineBreakMode:UILineBreakModeWordWrap];
- [header setTextAlignment:UITextAlignmentCenter];
- [self.view addSubview:header];
- ///////////////////////homeurl///////////////////////////
- homeurl=[[UILabel alloc]initWithFrame:CGRectMake(10, 50, 300, 30)];
- [homeurl setBackgroundColor:[UIColor clearColor]];
- [homeurl setTextColor:[UIColor blackColor]];
- [homeurl setFont:[UIFont fontWithName:@"Helvetica-Bold" size:14 ]];
- [homeurl setText: @"Home page URL:"];
- [self.view addSubview:homeurl];
- ///////////////////////hometext///////////////////////////
- hometext=[[UITextField alloc]initWithFrame:CGRectMake(10, 80, 300, 30)];
- [hometext setBackgroundColor:[UIColor clearColor]];
- [hometext setTextColor:[UIColor blackColor]];
- //[hometext setBorderStyle:[ UITextBorderStyleRoundedRect]];
- hometext.borderStyle=UITextBorderStyleRoundedRect;
- hometext.keyboardType = UIKeyboardTypeURL;
- [hometext setFont:[UIFont fontWithName:@"Helvetica" size:14 ]];
- hometext.placeholder=@"Type or paste the URL of your web app";
- hometext.autocorrectionType = UITextAutocorrectionTypeNo;
- [self.hometext setReturnKeyType:UIReturnKeyDone];
- [self.hometext addTarget:self
- action:@selector(textFieldShouldReturn:)
- forControlEvents:UIControlEventEditingDidEndOnExit];
- hometext.returnKeyType = UIReturnKeyDone;
- [self.view addSubview:hometext];
- ///////////////////////barcodeurl///////////////////////////
- barcodeurl=[[UILabel alloc]init];
- barcodeurl=[[UILabel alloc]initWithFrame:CGRectMake(10, 120, 300, 30)];
- [barcodeurl setBackgroundColor:[UIColor clearColor]];
- [barcodeurl setTextColor:[UIColor blackColor]];
- [barcodeurl setFont:[UIFont fontWithName:@"Helvetica-Bold" size:14 ]];
- [barcodeurl setText: @"Barcode lookup URL:"];
- [self.view addSubview:barcodeurl];
- //////////////////////barcodetext///////////////////////////////
- barcodetext=[[UITextField alloc]initWithFrame:CGRectMake(10, 160, 300, 30)];
- barcodetext.delegate = self;
- NSLog(@"hello");
- [barcodetext setBackgroundColor:[UIColor clearColor]];
- [barcodetext setTextColor:[UIColor blackColor]];
- barcodetext.borderStyle=UITextBorderStyleRoundedRect;
- barcodetext.keyboardType = UIKeyboardTypeURL;
- [barcodetext setFont:[UIFont fontWithName:@"Helvetica" size:14 ]];
- barcodetext.placeholder=@"Example:http//mydomain.com/q?ean=EAN";
- barcodetext.autocorrectionType = UITextAutocorrectionTypeNo;
- [self.barcodetext setReturnKeyType:UIReturnKeyDone];
- [self.barcodetext addTarget:self
- action:@selector(textFieldShouldReturn:)
- forControlEvents:UIControlEventEditingDidEndOnExit];
- barcodetext.returnKeyType = UIReturnKeyDone;
- [self.view addSubview:barcodetext];
- gpslabel=[[UILabel alloc]init];
- UIImage *img = [UIImage imageNamed:@"Done.png"];
- done=[[UIButton alloc]init];
- // [done setTitle:@"Done" forState:UIControlStateNormal];
- [done setImage:img forState:UIControlStateNormal];
- done.backgroundColor=[UIColor clearColor];
- [done addTarget:self action:@selector(back)
- forControlEvents:UIControlEventTouchUpInside];
- [done setFrame:CGRectMake(130, 400, 100, 40)];
- [self.view addSubview:done];
- locationController = [[MyCLController alloc] init];
- locationController.delegate = self;
- [locationController.locationManager startUpdatingLocation];
- locationLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, 230, 320, 30)];
- // [self.view addSubview:locationLabel];
- locationstr = [[NSString alloc]init];
- locationSwitch = [[[UISwitch alloc] initWithFrame:CGRectMake(180, 300, 320, 100)] autorelease];
- if ([locationstr isEqualToString:@"ON"]) {
- [locationSwitch setOn:YES animated:YES];
- }
- else {
- [locationSwitch setOn:NO animated:YES];
- }
- [locationSwitch addTarget:self action:@selector(locationSelector) forControlEvents:UIControlEventValueChanged];
- [self.view addSubview:locationSwitch];
- }
- -(void)back{
- NSLog(@"hhhh");
- str=[NSString stringWithFormat:@"my data is %@",self.barcodetext.text];
- BarCodeAppViewController *ob = [[BarCodeAppViewController alloc] initWithString:str];
- if(str==nil){
- //NSLog(@"hhhh");
- }
- [self presentModalViewController:ob animated:YES];
- // BarCodeAppViewController *ob = [[BarCodeAppViewController alloc] init];
- // [self presentModalViewController:ob animated:YES];
- }
- - (void)locationUpdate:(CLLocation *)location {
- locationLabel.text = [location description];
- //locationLabel.text=[location ];
- }
- - (void)locationError:(NSError *)error {
- locationLabel.text = [error description];
- }
- -(void)locationSelector{
- if(locationSwitch.on){
- self.locationstr = @"ON";
- NSLog(@"ON");
- }
- else{
- self.locationstr = @"OFF";
- NSLog(@"OFF");
- }
- }
- -(BOOL)textFieldShouldReturn:(UITextField *)theTextField {
- if (theTextField == hometext) {
- [hometext resignFirstResponder];
- }
- else if (theTextField == barcodetext) {
- [hometext resignFirstResponder];
- }
- return YES;
- }
- /*
- // Override to allow orientations other than the default portrait orientation.
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations.
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- */
- - (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 {
- [locationController release];
- [super dealloc];
- }
- @end
Add Comment
Please, Sign In to add comment