diff --git a/ios/AlmaZBarReaderViewController.m b/ios/AlmaZBarReaderViewController.m index a799949..3e53ddc 100644 --- a/ios/AlmaZBarReaderViewController.m +++ b/ios/AlmaZBarReaderViewController.m @@ -19,14 +19,39 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; - [button setTitle:@"Turn on Flash" forState:UIControlStateNormal]; + UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + //[button setTitle:@"Flash" forState:UIControlStateNormal]; [button sizeToFit]; + CGRect screenRect = [[UIScreen mainScreen] bounds]; + //[button setContentEdgeInsets:UIEdgeInsetsMake(20, 30, 20, 30)]; + CGRect frame; + if(screenRect.size.height>(screenRect.size.width)){ + frame = CGRectMake(0,0, screenRect.size.width*(0.15), screenRect.size.height*0.15); + + //button.center = CGPointMake( 0,0); + }else{ + frame = CGRectMake(0,0, screenRect.size.width*(0.10), screenRect.size.height*0.20); + + //button.center = CGPointMake(0,0); + } + + button.frame =frame; + button.layer.cornerRadius = 10; + button.clipsToBounds = YES; // Set a new (x,y) point for the button's center - button.center = CGPointMake(320/2, 60); + + UIImage *btnImage = [UIImage imageNamed:@"flash.png"]; + + [button setImage:btnImage forState:UIControlStateNormal]; + [button setBackgroundColor: [UIColor blackColor] ]; + + //[button setBackgroundColor:[UIColor colorWithRed:.859 green:.765 blue:.616 alpha:1.0] forState:UIControlStateHighlighted]; + + //button.center = CGPointMake( 0,0); [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:button]; - + } - (void)didReceiveMemoryWarning { @@ -38,8 +63,8 @@ CsZBar *obj = [[CsZBar alloc] init]; - [obj toggleflash]; - + [obj toggleflash]; + } @@ -69,13 +94,13 @@ } } /* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ + #pragma mark - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ @end