ultragtx / gsbookshelf Goto Github PK
View Code? Open in Web Editor NEWAn iBooks-styled book shelf for iOS (Animation of drag & drop, insert, remove...)
License: Other
An iBooks-styled book shelf for iOS (Animation of drag & drop, insert, remove...)
License: Other
Assume there are 100 books
Vertical: 3 books a row, 34 rows total
Landscape: 4 books a row, 25 rows total
Build and run the app in the simulator, turn on slow-motion animation.
Part 1
Issue:
When in vertical mode, scroll to the bottom, then rotate to landscape mode, during the slow animation, you won't see any shelf, just the background, when the rotate animation end, the view will scroll quickly from row 34 to row 25. This is not the visual effect we want.
Desired:
Before the rotate animation, jump to row 25 without animation, then the visual effect will be better.
Reality:
No matter where I try to set the contentOffset without animation and/or disable UIView animation, it will still animate during the rotation.
Part 2 (This has been fixed)
Issue:
Do the same thing in part 1, and then rotate back to vertical, you will see in the bottom shelf, the the right side board of the shelf behave differently as other shelfs
Reason:
The reused shelf used to be a vertical shelf, so the side board's position will not change from the landscape mode to the vertical mode.
Reality:
Tried to reset the frame of all reused shelf and relayout, but still behave like before.
Hi there is a controllor for use this component in iPad project?
hi, how i can use this component foro ipad native application? must change image? or how?
- (void)addButtonClicked:(id)sender {
int a[6] = {1, 2, 5, 7, 9, 22};
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
NSMutableArray *arr = [NSMutableArray array];
NSMutableArray *stat = [NSMutableArray array];
for (int i = 0; i < 6; i++) {
[indexSet addIndex:a[i]];
[arr addObject:[NSNumber numberWithInt:1]];
[stat addObject:[NSNumber numberWithInt:BOOK_UNSELECTED]];
}
[_bookArray insertObjects:arr atIndexes:indexSet];
[_bookStatus insertObjects:stat atIndexes:indexSet];
[_bookShelfView insertBookViewsAtIndexs:indexSet animate:YES];
the random number in indexset is bound to beyond bounds _bookArray,change to
int a[6] = {0, 1, 2, 3, 4, 5 } fix it;
thx for ur code ,I learned a lot
There is currently an issue whereby when you move books to new indexes, the book index will stay the same as it previously was. Also, when you create a new book, it will set the new book's index to '0', but the old book at '0' will also be at index '0' so there will be two 0 indexes.
Anybody with any answers as to why this may be happening can email me at [email protected] - I would greatly appreciate it. Thanks!
When call - (void)insertBookViewsAtIndexs:(NSIndexSet *)indexs animate:(BOOL)animate;
to insert new BookViews, I want to the BookView instance to operation on.
For example, user choose to download a book, the method will be called with parameter [NSMutableIndexSet indexSetWithIndex:0]. Then I want the BookView added to the 0 to operation on, for example, to display the download progress with it.
Now I can not find a simple way to get the correct BookView instance (in case if there is no book, and just download the first one). Hope there will be supporting for this. Like add method:
- (void)insertBookViewAnimation:(BOOL)animate callback:(void(^)(UIView *bookView))callback
hi...... thatz a fantanstic code out there... i am a newbie. i am working on a project which is similar to the bookshelfview, when clicked on each file, it should be downloaded. i hav tried but failed to remove the icons from the view.what i need is just a book shelf view which should be able to scroll. so that i can display my files in each row.
how to rermove the red,green...etc book icons of yours from the view.
on iPad.There's a mess.
Thanks a lot for this brilliant post.
I have stuck at a point.If I have to place complete wood image of Device size then where it should be set.
Hi ultragtx
How to extend first row and add UISeachBar bar into it?
I've customized your project for the ipad but UISearchBar is too long to display at the top.
tomoさんへ
WorkPlan.odsにランクAのものだけ予定を追加しました。
比較的ゆっくりの線をひきました。
駒木
When I dismiss the viewcontroller, didMovetoSuperView is called and then it call reload data....
didMovetoSuperView->reloadData->_headerView = [_dataSource headerViewOfBookShelfView:self];
Then error occured here.
Any suggestion? Maybe i don't close it something properly.
Regards
Error happen when remove bookview in bookShelf if
_visibleBookViews.count > stepsArray.count (in GSBookViewContainerView.m file) => index is out of stepsArray range
- (void)removeBookViewsAtIndexs:(NSIndexSet *)indexs animate:(BOOL)animate {
....
[UIView animateWithDuration:animate ? 0.15 : 0.0
delay:0.0
options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionLayoutSubviews
animations:^{
......
}completion:^(BOOL finished) {
//NSLog(@"disappear animation completion");
[UIView animateWithDuration:animate ? 0.3 : 0.0
delay:0.01
options:UIViewAnimationOptionCurveLinear
animations:^ {
//NSLog(@"move animation");
for (int i = 0; i < [_visibleBookViews count]; i++) {
UIView *bookView = [_visibleBookViews objectAtIndex:i];
[self moveBookView:bookView steps:[(NSNumber *)[stepsArray objectAtIndex:i] intValue]];
}
return;
}
completion:^(BOOL finished) {
........
}];
}];
....
}
hi, i try to use this controll in my application i push the principal control in my navigator , i can see the list book, but when i tap the back button in navigation bar i have a crash in didMoveToSuperview function
Build failed.
If numOfBooksInCell = 1
The app crash on this line: _bookViewSpacingWidth = (cellWidth - 2 * cellMargin - numOfBooksInCell * _bookViewWidth) / (numOfBooksInCell - 1);
because (numOfBooksInCell - 1) = 0.
my workaround:
NSInteger dividend = numOfBooksInCell-1;
if (dividend==0)
dividend=1;
File: GSBookViewContainerView
method: - (void)calculateLayout
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.