Skip to content

Commit

Permalink
testing camera
Browse files Browse the repository at this point in the history
  • Loading branch information
kentran committed Nov 10, 2014
1 parent 1a7f43d commit fb2eb7b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
12 changes: 6 additions & 6 deletions CTAssetsPickerController/CTAssetsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ - (void)setupAssets
};

[self.assetsGroup enumerateAssetsUsingBlock:resultsBlock];

if (self.imageCaptured) {
self.imageCaptured = NO;
[self.picker selectAsset:[self.assets lastObject]];
}
}


Expand Down Expand Up @@ -332,11 +337,6 @@ - (void)reloadAssets
{
self.assets = nil;
[self setupAssets];

if (self.imageCaptured) {
self.imageCaptured = NO;
[self.picker selectAsset:[self.assets lastObject]];
}
}


Expand Down Expand Up @@ -491,7 +491,7 @@ - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error context
if ([self.picker.delegate respondsToSelector:@selector(assetsPickerController:didFinishTakingPhoto:)])
[self.picker.delegate assetsPickerController:self.picker didFinishTakingPhoto:[self.assets firstObject]];
}];
self.imageCaptured = YES;
// self.imageCaptured = YES;
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
Expand Down
4 changes: 1 addition & 3 deletions CTAssetsPickerDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = CT;
LastUpgradeCheck = 0500;
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = "Clement T";
};
buildConfigurationList = ADE31D8117EFF08C008958B8 /* Build configuration list for PBXProject "CTAssetsPickerDemo" */;
Expand Down Expand Up @@ -386,7 +386,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -425,7 +424,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down
24 changes: 18 additions & 6 deletions CTAssetsPickerDemo/CTMasterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ of this software and associated documentation files (the "Software"), to deal


@interface CTMasterViewController ()
<CTAssetsPickerControllerDelegate, UIPopoverControllerDelegate>
<CTAssetsPickerControllerDelegate, UIPopoverControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>

@property (nonatomic, copy) NSArray *assets;
@property (nonatomic, strong) NSDateFormatter *dateFormatter;
Expand Down Expand Up @@ -82,11 +82,23 @@ - (void)didReceiveMemoryWarning

- (void)clearAssets:(id)sender
{
if (self.assets)
{
self.assets = nil;
[self.tableView reloadData];
}
// if (self.assets)
// {
// self.assets = nil;
// [self.tableView reloadData];
// }

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self;

[self presentViewController:imagePickerController animated:YES completion:NULL];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self dismissViewControllerAnimated:YES completion:NULL];
}

- (void)pickAssets:(id)sender
Expand Down

0 comments on commit fb2eb7b

Please sign in to comment.