/* * Copyright 2010-present Facebook * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import "SCPhotoViewController.h" @interface SCPhotoViewController () @property (strong, readwrite) UIImage* image; @end @implementation SCPhotoViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil image:(UIImage *) anImage { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.image = anImage; } return self; } - (void)viewDidLoad { [super viewDidLoad]; [self.imageView setImage:self.image]; } - (void)viewDidUnload { [super viewDidUnload]; self.imageView = nil; self.image = nil; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.navigationController.navigationBarHidden = YES; } - (void)viewWillDisappear:(BOOL)animated { self.navigationController.navigationBarHidden = NO; [super viewWillDisappear:animated]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } - (IBAction)confirm:(id)sender { if (self.confirmCallback) { self.confirmCallback(self, YES); } [self.navigationController popViewControllerAnimated:YES]; } - (IBAction)cancel:(id)sender { if (self.confirmCallback) { self.confirmCallback(self, NO); } [self.navigationController popViewControllerAnimated:YES]; } @end