AGImagePickerController
AGImagePickerController copied to clipboard
I fixed all bugs
Hi friends, I fixed all bugs. I will upload the files as soon as possible.
Zoelounge, Where are you uploading the files to?
Hello Zoelounge. Does it fixes the "funky rotation problems" reported by the user StayHungryApps in the "No thumnails are shown on iOS7" thread? Some uiviewtable cells are overlapping when the device orientation changes. Thank you.
Ok boys, i'm going to add the code that fix all bugs.
Excuse my English ok!?
I resolve 2 bugs: 1 - toolbar "select all" and "deselect al" 2 - Gost image.
Sorry stephanelx, I didn't notice about "funky rotation problems" maybe because i use landscape modei only on iPad, and i didn't use Landscape mode on iPhone.
Before you start you can download the project from https://github.com/mokten/AGImagePickerController and then apply the code below:
In AGIPCAsstesControl.m change the method - (NSArray *)itemsForRowAtIndexPath:(NSIndexPath *)indexPath with the method below:
-
(NSArray *)itemsForRowAtIndexPath:(NSIndexPath *)indexPath { NSMutableArray *items = [NSMutableArray arrayWithCapacity:self.imagePickerController.numberOfItemsPerRow];
NSUInteger startIndex = indexPath.row * self.imagePickerController.numberOfItemsPerRow, endIndex = startIndex + self.imagePickerController.numberOfItemsPerRow - 1;
// THI IS THE CODE WITH THE BUG
// if (startIndex < self.assets.count )
// {
// if (endIndex > self.assets.count - 1)
// endIndex = self.assets.count - 1;
//
// for (NSUInteger i = startIndex; i <= endIndex; i++)
// {
// [items addObject:(self.assets)[i]];
// }
// }
// Zoe: i have add this snippet of code:
if (startIndex < (double)self.assetsGroup.numberOfAssets)
{
if (endIndex > (double)self.assetsGroup.numberOfAssets - 1)
endIndex = (double)self.assetsGroup.numberOfAssets - 1;
for (NSUInteger i = startIndex; i <= endIndex; i++)
{
[items addObject:(self.assets)[i]];
}
}
return items;
}
In the same file change method -(loadAssets) with the method below
-
(void) loadAssets { [self.assets removeAllObjects];
[self.assetsGroup enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
AGIPCGridItem *gridItem = [[AGIPCGridItem alloc] initWithImagePickerController:self.imagePickerController asset:result andDelegate:self]; if ( self.imagePickerController.selection != nil && [self.imagePickerController.selection containsObject:result]) { gridItem.selected = YES; }
// Zoe resolve bug about toolbar for "select all" and "deselect all"
if(index < (double)self.assetsGroup.numberOfAssets){
[self.assets addObject:gridItem];
}
}];
dispatch_async(dispatch_get_main_queue(), ^{
[self reloadData];
});
I hope I have helped some of you.
good night.
It's allright zoelounge, anyway I found the problem with orientation changes. Using dequeueReusableCellWithIdentifier when initializing UITableView cells was causing this weird behavior. Until I find a better solution, I'll simply avoid using it.
Stephanelx i'm sorry but i din't have the orientation problem. Can you tell me wich is the problem in a fee word?
Can you send me a video about the problem ? Best
Sure! The problem occur when I am changing the orientation of the ios device. Thumbnails are not positioned correctly. Images are overlapping as you can see in the following screenshot:
Great work! Thank you for the fixes.
Zoe have you solved this? : Take picture from device camera, edit it with camera control (apply filter etc). save it in photo library. now launch your app. get that edited image from library using AGImagePicker. assign to some image view. no edit effects feels here.
(ios 7)