Skip to content

Instantly share code, notes, and snippets.

@patelrohan
Created February 18, 2012 08:57
Show Gist options
  • Save patelrohan/1858343 to your computer and use it in GitHub Desktop.
Save patelrohan/1858343 to your computer and use it in GitHub Desktop.
First screen after I capture image from camera.
- (void)viewDidLoad
{
[super viewDidLoad];
btn = 50;
scroll.contentSize = CGSizeMake(320, 570);
app.edit_flag=1;
[btn1 setBackgroundImage:[UIImage imageNamed:@"red_border_box.png"] forState:UIControlStateNormal];
UIBarButtonItem *cancel_btn=[[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelBtnClicked:)];
self.navigationItem.rightBarButtonItem=cancel_btn;
// set round corner
CALayer * l = [imageBGView layer];
[l setMasksToBounds:YES];
[l setCornerRadius:5.0];
theNewPic.layer.borderColor=[UIColor whiteColor].CGColor;
theNewPic.layer.borderWidth=2.0;
titleBGView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"img1.png"]];
locationBGView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"img2.png"]];
timeBGView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"img3.png"]];
notesBGView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"img4.png"]];
UINavigationBar *navBar = [[self navigationController] navigationBar];
navBar.hidden=FALSE;
navBar.backItem.hidesBackButton = TRUE;
self.navigationController.navigationBarHidden = NO;
[navBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
app = [[UIApplication sharedApplication]delegate];
addChanged = FALSE;
flag = 0;
spotTimeText = [NSString alloc];
fullPathThumb = [NSString alloc];
if ([app.selectedSpotId isEqualToString:@"0"])
{
theNewPic.image = [[UIImage alloc] initWithData:imageData];
SpotName.text = @"";
SpotLocation.text = @"";
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"MMM dd, yyyy HH:mm a"];
NSDate *now = [[NSDate alloc] init];
NSString *dateString1 = [format stringFromDate:now];
NSString *dateString = [NSString stringWithFormat:@"%@",[self convertHour:dateString1]];
spotTimeText = dateString;
[spotTime setUserInteractionEnabled:TRUE];
NSArray *onlytime = [dateString componentsSeparatedByString:@" "];
NSString *newString = [[NSString alloc]initWithFormat:@"%@ %@",[onlytime objectAtIndex:3],[onlytime objectAtIndex:4]];
spotTime.text = newString;
if(map == 0)
{
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter=kCLHeadingFilterNone;
[locationManager startUpdatingLocation];
}
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
else
{
// [spotTime setUserInteractionEnabled:FALSE];
[saveButton setTitle:@"Update this Spot !" forState:UIControlStateNormal];
[self getSelectedSpot];
}
if(map == 1)
{
MySpot *obj = [app.temp objectAtIndex:0];
SpotName.text = obj.SpotName;
SpotNote.text = obj.SpotNote;
NSArray *onlytime = [obj.SpotTime componentsSeparatedByString:@" "];
NSString *newString = [[NSString alloc]initWithFormat:@"%@ %@",[onlytime objectAtIndex:3],[onlytime objectAtIndex:4]];
spotTime.text = newString;
imageData = obj.imgData;
theNewPic.image = obj.SpotTempImage;
lat1 = clat;
lon1 = clon;
[self getAddress:lat1 withLong:lon1];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment