Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed for iOS 5 - changed for new ALAssetsLibrary behavior

  • Loading branch information...
commit c0a9d617723c260f75ca3ff2722319640e39c3d8 1 parent f311146
@cschep cschep authored
View
4 Classes/ELCAlbumPickerController.h
@@ -6,13 +6,15 @@
//
#import <UIKit/UIKit.h>
-
+#import <AssetsLibrary/AssetsLibrary.h>
@interface ELCAlbumPickerController : UITableViewController {
NSMutableArray *assetGroups;
NSOperationQueue *queue;
id parent;
+
+ ALAssetsLibrary *library;
}
@property (nonatomic, assign) id parent;
View
12 Classes/ELCAlbumPickerController.m
@@ -5,7 +5,6 @@
// Copyright 2011 ELC Technologies. All rights reserved.
//
-#import <AssetsLibrary/AssetsLibrary.h>
#import "ELCAlbumPickerController.h"
#import "ELCImagePickerController.h"
#import "ELCAssetTablePicker.h"
@@ -29,6 +28,8 @@ - (void)viewDidLoad {
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
self.assetGroups = tempArray;
[tempArray release];
+
+ library = [[ALAssetsLibrary alloc] init];
// Load Albums into assetGroups
dispatch_async(dispatch_get_main_queue(), ^
@@ -45,9 +46,6 @@ - (void)viewDidLoad {
[self.assetGroups addObject:group];
- // Keep this line! w/o it the asset count is broken for some reason. Makes no sense
- NSLog(@"count: %d", [group numberOfAssets]);
-
// Reload albums
[self performSelectorOnMainThread:@selector(reloadTableView) withObject:nil waitUntilDone:YES];
};
@@ -63,13 +61,10 @@ - (void)viewDidLoad {
};
// Enumerate Albums
- ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll
usingBlock:assetGroupEnumerator
failureBlock:assetGroupEnumberatorFailure];
-
- [library release];
[pool release];
});
}
@@ -161,7 +156,8 @@ - (void)viewDidUnload {
- (void)dealloc
{
- [assetGroups release];
+ [assetGroups release];
+ [library release];
[super dealloc];
}
View
2  Classes/ELCAssetCell.m
@@ -14,7 +14,7 @@ @implementation ELCAssetCell
-(id)initWithAssets:(NSArray*)_assets reuseIdentifier:(NSString*)_identifier {
- if(self = [super initWithStyle:UITableViewStylePlain reuseIdentifier:_identifier]) {
+ if(self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_identifier]) {
self.rowAssets = _assets;
}
View
3  Classes/ELCAssetTablePicker.m
@@ -89,8 +89,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
return ceil([self.assetGroup numberOfAssets] / 4.0);
}
-// ugly
--(NSArray*)assetsForIndexPath:(NSIndexPath*)_indexPath {
+- (NSArray*)assetsForIndexPath:(NSIndexPath*)_indexPath {
int index = (_indexPath.row*4);
int maxIndex = (_indexPath.row*4+3);
View
2  Classes/ELCImagePickerController.m
@@ -51,7 +51,7 @@ -(void)selectedAssets:(NSArray*)_assets {
#pragma mark Memory management
- (void)didReceiveMemoryWarning {
- NSLog(@"ELC Image Picker received memory warning!!!");
+ NSLog(@"ELC Image Picker received memory warning.");
[super didReceiveMemoryWarning];
}
View
4 Classes/ELCImagePickerDemoViewController.m
@@ -34,6 +34,10 @@ - (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPic
[self dismissModalViewControllerAnimated:YES];
+ for (UIView *v in [scrollview subviews]) {
+ [v removeFromSuperview];
+ }
+
CGRect workingFrame = scrollview.frame;
workingFrame.origin.x = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.