alanquatermain / aqgridview Goto Github PK
View Code? Open in Web Editor NEWA grid view for iPhone/iPad, designed to look similar to NSCollectionView.
Home Page: http://quatermain.tumblr.com/
License: BSD 3-Clause "New" or "Revised" License
A grid view for iPhone/iPad, designed to look similar to NSCollectionView.
Home Page: http://quatermain.tumblr.com/
License: BSD 3-Clause "New" or "Revised" License
the AQGridViewCell
contentView
is not labeled as IBOutlet. This makes it very difficult to have a custom cell defined in a nib file without juggling views in awakeFromNib
.
It seems to me AQGridView was not designed to accept custom cells defined in a nib file, though not much is needed to make it work.
Perhaps adding a 4th sample that does just that could help, something similar to the AdvancedTableViewCells sample code from Apple.
App crashes when deleting items in second last row
This happens when
It seems like the problem is in this line which adds NSNotFound to animatingDestinationIndices (AQGridView.m:1631, 5995654c1ed39a81a09e):
for ( AQGridViewAnimatorItem * item in _animatingCells )
{
[animatingDestinationIndices addIndex: item.index];
}
I got this from the debugger console:
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableIndexSet addIndexesInRange:]: Range {2147483647, 1} exceeds maximum index value of NSNotFound - 1'
*** Call stack at first throw:
(
0 CoreFoundation 0x3587a987 exceptionPreprocess + 114
1 libobjc.A.dylib 0x34a8249d objc_exception_throw + 24
2 CoreFoundation 0x3587a7c9 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x3587a803 +[NSException raise:format:] + 34
4 Foundation 0x3118d10d -[NSMutableIndexSet addIndexesInRange:] + 96
5 Foundation 0x3118d0a7 -[NSMutableIndexSet addIndex:] + 18
6 50k 0x0003589f -[AQGridView(AQCellLayout) updateVisibleGridCellsNow] + 3386
7 50k 0x000310bb -[AQGridView layoutSubviews] + 202
8 UIKit 0x341b80cf -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
9 CoreFoundation 0x35818bbf -[NSObject(NSObject) performSelector:withObject:] + 22
10 QuartzCore 0x31075685 -[CALayer layoutSublayers] + 120
11 QuartzCore 0x3107543d CALayerLayoutIfNeeded + 184
12 QuartzCore 0x3106f56d _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212
13 QuartzCore 0x3106f383 _ZN2CA11Transaction6commitEv + 190
14 QuartzCore 0x31092f9d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
15 CoreFoundation 0x3580ac59 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 16
16 CoreFoundation 0x3580aacd __CFRunLoopDoObservers + 412
17 CoreFoundation 0x358020cb __CFRunLoopRun + 854
18 CoreFoundation 0x35801c87 CFRunLoopRunSpecific + 230
19 CoreFoundation 0x35801b8f CFRunLoopRunInMode + 58
20 GraphicsServices 0x320c84ab GSEventRunModal + 114
21 GraphicsServices 0x320c8557 GSEventRun + 62
22 UIKit 0x341dc329 -[UIApplication _run] + 412
23 UIKit 0x341d9e93 UIApplicationMain + 670
24 50k 0x00002e2b main + 70
25 50k 0x00002de0 start + 40
)
terminate called after throwing an instance of 'NSException'
I'm experimenting with the code provided and it is really useful; however, I found that the sample (springboard) code crashes, if you reduce the number of icons down to 19, then try to move to an empty spot.
This is relatively reproducible - sometimes when moving cells around and doing sorts by dragging, one of the other cells will go invisible. Re-moving a cell usually clears it up. This seems to occur when the message Warning: tried to add duplicate gridview cell
gets printed to the console - twice in a row.
Sometimes scrolling will re-draw the cells appropriately, but at other times it will simply change which index becomes invisible.
Hi,
Making AQGridViewCell a subclass of UITableViewCell would make it possible to use the Interface Builder Table View Cell standard item. Did you perhaps consider that idea and reject it? Is there some pitfall to take into account?
Conceptually, it makes quite a bit of sense also, as the two classes share a lot of behavior.
I've to say that it's not an issue,it's instead an "help" request I hope it's the right place for asking
The problem I'm facing is that I'm not able to edit my gridView, at the moment I'm trying to delete some cell with no results.
What I've done so far:
- (void) gridView:(AQGridView *) aGridView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndex:(NSUInteger) index {
NSLog(@"editing");
NSIndexSet *visibleCellsIndex = [self.gridView visibleCellIndices];
[self.gridView deleteItemsAtIndices:visibleCellsIndex
withAnimation:AQGridViewItemAnimationFade];
[texmeDataObject.prunedDirContents removeObjectAtIndex:index];
[editButton setStyle:UIBarButtonItemStyleBordered];
[editButton setTitle:@"edit"];
}
I've the following action linked to a button
(void) toggleEdit:(id)sender {
[self.gridView setEditing:!self.gridView.editing animated:YES];
[editButton setTitle:@"delete"];
[editButton setStyle:UIBarButtonItemStyleDone];
}
this code don't work the method commitEditingStyle isn't called. I've looked in the examples but none of them delete some content. That's all, I hope someone can help me.
Last but not least sorry for my English :)
The static analyzer detects a potential leak on the last line of this method:
UIScrollView usually has bounce ability by setting the property. I've tried this:
AQGridView * contentView = [[AQGridView new] autorelease];
contentView.backgroundColor = [UIColor whiteColor];
contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
contentView.autoresizesSubviews = YES;
contentView.delegate = self;
contentView.dataSource = self;
contentView.resizesCellWidthToFit = NO;
contentView.bounces = YES;
contentView.alwaysBounceVertical = YES;
contentView.alwaysBounceHorizontal = YES;
but nothing happens with Bouncing, seems like it does not work...
Please forgive me if this is an obvious or brain-dead question - I'm still learning the ropes. I'm populating an array with image data on a return from the locationManager. Once that array is populated I want to load the gridview with those images. I've created a method called "showResultGrid" that receives the array of images and then calls [self.gridView reloadData] from within my veiwController. I'm getting to the point where the reloadData call is made - but the debugger just steps on past the line without going into reloadData. (I've stepped through ImageDemo, and I CAN step into reloadData) - so I must be missing something somewhere, but for the life of me I can't figure out what. Does this sound at all familiar? Are there any gotchas that I can check? THANK YOU for any help that you can provide!!
Hello,
Can I use this on a commercial app?
Building from master (SHA: 2d86535)
OS X 10.6.6, Xcode 4 Release
CompileC /Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/Objects-normal/armv6/AQGridViewCell.o Classes/AQGridViewCell.m normal armv6 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/david/src/mascot/AQGridView
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/Users/david/bin:/Users/david/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/X11/bin:/Applications/MAMP/Library/bin:/Applications/SlickEditV1600Beta2.app/Contents/MacOS:/usr/local/CrossPack-AVR/bin:/usr/local/libexec/git-core:/Users/david/jruby-1.4.0/bin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -x objective-c -arch armv6 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk -gdwarf-2 -mthumb -miphoneos-version-min=3.0 -iquote /Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/AQGridView-generated-files.hmap -I/Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/AQGridView-own-target-headers.hmap -I/Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/AQGridView-all-target-headers.hmap -iquote /Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/AQGridView-project-headers.hmap -I/Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Products/Debug-iphoneos/include -I/Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/DerivedSources/armv6 -I/Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/DerivedSources -F/Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Products/Debug-iphoneos -include /Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/PrecompiledHeaders/AQGridView_Prefix-fetolvgujrgdbvacqubhqacgvuhc/AQGridView_Prefix.pch -DBUILTIN_IMAGES -c /Users/david/src/mascot/AQGridView/Classes/AQGridViewCell.m -o /Users/david/Library/Developer/Xcode/DerivedData/AQGridView-drwuiywfznqzqsbhctcmsrtjwrgx/Build/Intermediates/AQGridView.build/Debug-iphoneos/AQGridView.build/Objects-normal/armv6/AQGridViewCell.o
/Users/david/src/mascot/AQGridView/Classes/AQGridViewCell.m:314:5: error: use of undeclared identifier 'imageName' [2]
imageName = @"AQGridSelectionGray.png";
^
/Users/david/src/mascot/AQGridView/Classes/AQGridViewCell.m:318:5: error: use of undeclared identifier 'imageName' [2]
imageName = @"AQGridSelectionGrayBlue.png";
^
/Users/david/src/mascot/AQGridView/Classes/AQGridViewCell.m:322:5: error: use of undeclared identifier 'imageName' [2]
imageName = @"AQGridSelectionGreen.png";
^
/Users/david/src/mascot/AQGridView/Classes/AQGridViewCell.m:326:5: error: use of undeclared identifier 'imageName' [2]
imageName = @"AQGridSelectionRed.png";
^
4 errors generated.
hi,
i'm using your developed AQGridView for myself project. I have an question.
Best regards,
AT
As of commit 672a56d, there is a leaked CFMutableDictionaryRef created on line 647 (animatingCellTable). It's created but never released.
there is no setter method for usesPagedHorizontalScrolling. The header implies that you can change this property to get a horizontally paged view, is this just incomplete right now?
Hi,
When I create my custom cells and use the same methods used for creating custom cells with interface builder in tableviews, it doesn't work, the cells are blank. Is there a fix? Or am I using the wrong approach?
Hi Alan,
Thanks for the great code!
I've been trying to implement AQGridView against an NSFetchedResultsController for about an hour now without much luck. It seems that numberOfItemsInGridView:
is called as expected (and returns an integer greater than 0), but gridView:cellForItemAtIndex:
is never called.
I set the delegate and datasource to the current instance, but it never seems to do anything. I'm happy to provide any information, but I'll have to obfuscate some of the details in my code if that's required.
I am still working on loading an AQGridView from a Nib file. In that context, two issues regarding awakeFromNib:
1- AQGridView doesn't have an AwakeFromNib method. This means that an AQGridView loaded from a Nib file is not properly set up. I propose:
- (void) awakeFromNib
{
[super awakeFromNib];
[self _sharedGridViewInit];
}
2- AQGridViewController does have an awakeFromNib method, but it fails to call [super awakeFromNib] as recommended by Apple. Change it to:
- (void) awakeFromNib
{
[super awakeFromNib];
[self _sharedGridViewDefaultSetup];
}
Hi,
I made a grid view which takes the half of the screen. It works fine when the ipad is not connected to the mac, but when connected and in debug mode, when I click anywhere on the screen (outside the grid view), it looks like the grid view takes this position as a click on one of its own cells.
What may you say about that?
Thanks,
Alex
In reloadData there is this call:
[self enqueueReusableCells: _visibleCells];
Inside which call there is this test:
- (void) enqueueReusableCells: (NSArray *) reusableCells
{
for ( AQGridViewCell * cell in reusableCells )
{
if ( [_visibleCells containsObject: cell] )
{
NSLog( @"Warning: tried to add duplicate gridview cell" );
continue;
}
Clearly, this will be triggered every time. So we get a spurious warning. More problematic, the continue
statement means that the cells will not be enqueued.
Since I have not analyzed the whole flow, I am a bit nervous about removing the test altogether. Could you confirm that this test is simply inappropriate?
Regards,
Jean-Denis
Hi,
on iphone 3g (os 3.1) the app crashes because of the references to UIPopoverController.
Target sdk is 3.2. Deploy sdk is 3.0
How can I fix it?
-c.
AQGridViewController cannot be used in a Pop Up like a Normal Table View can.
This code does not work.
fileTypePicker = [[[FileTypeViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
fileTypePicker.delegate = self;
self.fileTypePopover = [[[UIPopoverController alloc] initWithContentViewController:fileTypePicker] autorelease]
[self.fileTypePopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Specifically initWithStyle:
which crashes the App. How is the issue solved?
Since it's not possible to set the identifier of the cell in Interface Builder, it has to be initialized in awakeFromNib
. However this is not possible since the reuseIdentifier
property is declared read-only in the @interface
. This prevents me from doing the following in my cell subclass:
- (void)awakeFromNib {
[super awakeFromNib];
self.reuseIdentifier = @"CellIdentifier";
}
Note that this property is privately redeclared read-write in the implementation file, which lets AQGridViewCell
do it in its initialization routines:
self.reuseIdentifier = reuseIdentifier;
Of course, I can still do (and indeed I must do):
_reuseIdentifier = @"CellIdentifier";
But that kind of defeats the idea of a property.
Of course, if AQGridViewCell
was a subclass of UITableViewCell
, this would be moot as I could set the identifier in IB.
Did you test/try it on iOS4?
I'm having some really weird memory leaks in my code, which seems to be caused by the AQGridViewCell contentView method, basically it looks like the _contentView object is not getting released, here is the Instruments screen shot http://andyzaharia.com/instruments_screenshot.png
And here is the source code where it happens http://andyzaharia.com/leaks.zip
I just spent an entire day trying to figure out why this happens and no luck so far, anyone can help ? :)
Thanks a lot, and thank you for this wonderful grid view !
I run the app in portrait mode. Works fine.
http://www.studiomagnolia.it/tmp/photo1.PNG
I rotate and the last line of the last cell is not drawn
http://www.studiomagnolia.it/tmp/photo2.PNG
If you do the opposite (first landscape and then portrait) almost the same happens. One line is not dranw.
I verified the same behavior in your ImageDemo example.
I am testing AQGridView, where I load different data based on the filter defined and it's not updating cells when I call reloadData and still displays same cells. Just looking at the code, there seems to be a problem with animation as updateVisibleGridCellsNow method finds _animationCount > 0 and returns without updating the view. Please help.
It would be nice to have the ability, much like the current iOS UITableView to support grouping.
I realize this is a potentially double edge sword (i.e. it would be bad for it to degenerate into a giant tree grid which tend to have usability issues) :)
Depending on how deep I can get into the code, I hope to also take a stab at this myself and give back a bit to the project.
I created my own cell which only contains ImageView. By using the UIImageView everything works as expected, but by just changing the UIImageView to TTImageView everything actually works except I am unable to pick a cell. When I click on a cell it does not get chosen.
Anyone with any ideas ?
This is a feature suggestion: The ability to specify how many rows off the current view you would like pre-loaded. For instance, I extended AQGridView so you could specify that 2 rows of cells should be loaded above and below the visibleBounds, this helps ensure that the cells have all their content loaded by the time they become visible (in case you're loading content via threads or http).
Calling AQGridView's reloadData
from the viewController's viewDidAppear
seems to lock scrolling until the orientation changes -- at which point scrolling works correctly again.
Here is the error from Console:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'visible cell count after animation doesn't match visible indices'
And here is the stack trace:
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 CoreFoundation 0x02879de4 TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION + 4
1 libobjc.A.dylib 0x93e7d509 objc_exception_throw + 56
2 CoreFoundation 0x0283a01b +[NSException raise:format:arguments:] + 155
3 Foundation 0x000ccf64 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 SpringBoard 0x00007cf0 -[AQGridView fixCellsFromAnimation] + 1520 (AQGridView.m:751)
5 SpringBoard 0x00008765 -[AQGridView cellUpdateAnimationStopped:finished:context:] + 97 (AQGridView.m:847)
6 UIKit 0x002ee288 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 249
7 UIKit 0x002efc82 +[UIViewAnimationState popAnimationState] + 2548
8 SpringBoard 0x0000864f -[AQGridView endUpdateAnimations] + 1111 (AQGridView.m:830)
9 SpringBoard 0x00008902 -[AQGridView _updateItemsAtIndices:updateAction:withAnimation:] + 195 (AQGridView.m:878)
10 SpringBoard 0x000089c2 -[AQGridView reloadItemsAtIndices:withAnimation:] + 58 (AQGridView.m:893)
11 SpringBoard 0x00003f07 -[SpringBoardViewController moveActionGestureRecognizerStateChanged:] + 2889 (SpringBoardViewController.m:277)
12 UIKit 0x0052e59a -[UIGestureRecognizer _updateGestureWithEvent:] + 641
13 UIKit 0x0052b0fb -[UIGestureRecognizer _delayedUpdateGesture] + 41
14 UIKit 0x0052f5a1 _UIGestureRecognizerUpdateObserver + 558
15 CoreFoundation 0x027fd8a2 __CFRunLoopDoObservers + 626
16 CoreFoundation 0x027c9ae5 CFRunLoopRunSpecific + 2709
17 CoreFoundation 0x027c9048 CFRunLoopRunInMode + 88
18 GraphicsServices 0x0303189d GSEventRunModal + 217
19 GraphicsServices 0x03031962 GSEventRun + 115
20 UIKit 0x002d0de1 UIApplicationMain + 1134
21 SpringBoard 0x00002858 main + 102 (main.m:14)
22 SpringBoard 0x000027c6 start + 54
I'm trying to prevent selection of a cell by returning NSNotFound in the willSelect and willDeselect delegate methods for my grid, but it's not having any effect.
Looking in the source code, it looks like it is ignoring the return value of these delegate calls when it should be assigning the return value to the 'index' variable.
It used to be that the horizontal scrolling wouldn't allow vertical scrolling. In many cases, this is desirable behavior. For example, if you have a grid that only scrolls horizontally in one orientation but allows vertical and horizontal scrolling when you move to another orientation.
Since the commit listed below, though, the content size of the grid is always forced to be one more pixel high than the grid size, meaning the grid will always scroll vertically, even if you don't want it to. I'm not sure why this commit was made or what problem it was solving, but it seems like an unnecessary thing to force. If anything, it should be available as a configurable option. Though I think it should be dropped altogether:
I come across this several times while playing with SpringBoard example code. To reproduce:
0 CoreFoundation 0x011405a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01294313 objc_exception_throw + 44
2 CoreFoundation 0x011420bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x010b1966 ___forwarding___ + 966
4 CoreFoundation 0x010b1522 _CF_forwarding_prep_0 + 50
5 RemoteDesktopSearch 0x00011aad -[AQGridView(AQCellLayout) updateVisibleGridCellsNow] + 957
6 RemoteDesktopSearch 0x0000bea5 -[AQGridView layoutSubviews] + 357
7 QuartzCore 0x000f7a5a -[CALayer layoutSublayers] + 181
8 QuartzCore 0x000f9ddc CALayerLayoutIfNeeded + 220
9 QuartzCore 0x0009f0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
10 QuartzCore 0x000a0294 _ZN2CA11Transaction6commitEv + 292
11 QuartzCore 0x000a046d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
12 CoreFoundation 0x0112189b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
13 CoreFoundation 0x010b66e7 __CFRunLoopDoObservers + 295
14 CoreFoundation 0x0107f1d7 __CFRunLoopRun + 1575
15 CoreFoundation 0x0107e840 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x0107e761 CFRunLoopRunInMode + 97
17 GraphicsServices 0x01c871c4 GSEventRunModal + 217
18 GraphicsServices 0x01c87289 GSEventRun + 115
19 UIKit 0x00467c93 UIApplicationMain + 1160
20 RemoteDesktopSearch 0x00001c44 main + 102
21 RemoteDesktopSearch 0x00001bd5 start + 53
Thanks!
Sam
I'm getting a lot of NSLog console output from this line:
NSLog(@"%i >= %i ?", index, [_visibleCells count]);
It's in AQGridView.m, line 1594.
Is there any purpose to this? It might be a good idea to remove it in order to improve scroll performance.
When you first move a couple of SpringBoard icons, and then tap anywhere in the AQGridView
, chances are good the app will crash. (This happens in both the SpringBoard example as my own app which uses the basic SpringBoard code to allow the user to move cells)
Why? Because for some reason hitView
inside touchesEnded:withEvent:
in AQGridView.m
doesn't 'contain' a UIView
, but an object of another type, that doesn't respond to the superview
selector called on it on line 1287. This obviously results in an unrecognized selector sent
exception: a crash.
Why hitView
contains a random object, and not the tapped UIView
however, I'm not sure... It probably has something to do with _touchedContentView
not pointing in the right direction, as this is the object that's retain
ed and then assigned to hitView
.
PS. Sometimes the app doesn't crash when tapping after moving, this is because you're lucky and hitView
actually points to an object that responds to superview
, but it's almost never the UIView
that hitView
should be (the tapped view).
When calling the method "deleteItemsAtIndices:(NSIndexSet *)indices withAnimation:(AQGridViewItemAnimation)animation;" in AQGridView.h on the very last cell in the grid, the app crashes with the following errors:
Assertion failure in -[AQGridView fixCellsFromAnimation], AQGridView.m:788
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'visible cell count after animation (17) doesn't match visible indices (18)'
I verified that the code is attempting to delete the proper index, and that it returns the correct number of cells after a cell is deleted.
Note that calling this method on any cell other than the very last one works as intended. Please let me know if you need more information.
Thanks!
AQGridViewCell
initialization routines initWithFrame
and awakeFromNib
essentially do the same thing, except that initWithFrame
also does:
_cellFlags.setShadowPath = 0;
_selectionGlowShadowRadius = 12.0f;
Are these two lines missing in awakeFromNib
?
Added the project into the Frameworks folder, made it a Direct Dependency in the app, as well as added the path for AQGridView to the Header Search Paths and User Header Search Paths. Added '-ObjC' and '-all_load' to Other Linker Flags since it is a 4.0 project. What else am I missing?
If you put an AQGridView in an AQGridViewController with a black translucent navigation bar, the view should be laid out so that it extends underneath the nav bar, and have a negative contentOffset.y value to show a blank area which is shown under the nav bar when scrolled to the top. This situation is not being accounted for in the layout code.
If a button is released quickly after being dragged, it will snap to the wrong position.
tried both
gridView.separatorColor = [UIColor redColor]
[gridView setSeparatorColor: [UIColor redColor]]
No luck. Also tried the same in your ImageDemo, but no luck again.
Do you think itβs a good idea to move code from the Springboard example back to the grid view itself?
I am playing with AQGridView to try to replicate a IBooks-like look and feel, with shelves and the like. I can't manage to display the background shelves properly:
I am about to develop a custom tiling UIView subclass to set as the background view. Would that be the correct approach?
TIA
Jean-Denis
Using the SpringBoard example I get a strange behavior when changing _gridview.scrollable to YES and increasing the items to e.g. 40:
Dragging cells around works as expected until the view is scrolled down. Once scrolled down, drag any cell and drop it at the new place. What happens is that the cell first moves all the way down out of screen and snaps then back to the new location.
If I have more than 400 items and a background view set when scrolling all graphics draw over each other and don't clear like http://cl.ly/3x0g343F442Y0o3n072Q
It all works fine with 100 cells.
Does anyone know why this actually happens?
In the ImageDemo example, if you put the following line in the viewDidLoad
method of the ImageDemoViewController
:
self.gridView.layoutDirection = AQGridViewLayoutDirectionHorizontal;
you get the following error (backtrace here: https://gist.github.com/b87ae0e00ed585cc5fd2):
2010-06-04 00:17:46.198 ImageDemo[25683:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (range.location >= 0) && (range.location + range.length <= [_visibleCells count])'
Additionally, if you reduce the height of the GridView to lets say 200px, you get an EXC_ARITHMETIC
error (backtrace here: https://gist.github.com/15ffe23f2d2af3ff3921)
After deleting the last cell in row, the app crashes with the following NSRangeException.
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectsAtIndexes:]: the last index (19) must be less than the count (19).'
2010-11-10 10:01:12.900 SpringBoard[2038:207] Stack: (
43575376,
44733228,
43312907,
43312746,
810502,
46066,
28950,
41543958,
41543205,
41486802,
41486130,
41686758,
43063890,
42853189,
42850472,
52562077,
52562274,
3117938,
9456,
9310
)
terminate called after throwing an instance of 'NSException'
I've added an AQGridView to a XIB file's main view, as done in the ImageDemoViewController example. The XIB's owner is a view controller derived from AQGridViewController. It's set up as the delegate; it's just like the ImageDemoViewController in the example.
Bu the grid is always blank, because numberOfItemsPerRow in AQGridViewData always returns 0, because _boundsSize width and height are always 0. My controller is getting called as the delegate, because numberOfItemsInGridView gets called.
It's too bad; this looks like a cool class.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.