Closed francesc-o closed 8 years ago
The way I implemented it is if you provide a scrollView with a contentSize too small (only a few cells) to scroll the entire screen (until the segmented control touches the navigation bar) then the 'contentScrollView.contentInset.bottom' will be adjusted in order to compensate, so that the scrollView can always be scrolled enough so that the segmented control touches the navigation bar which creates "extra space". This was a UX decision since seamlessly switching between segments becomes difficult otherwise.
Does this sound like what you are describing? I can look into this further if this behaviour is not what your problem is.
Note: DBProfileViewController only interacts with contentViewControllers via the "contentScrollView" property. The controller is completely unaware of whether that is a table view or collection view, so it will never affect header or footer views.
Ok, I understood the behavior of scroll view if there're few cells (contentSize too small) and the final note, but in my case cells are loaded dynamically (I'm using YouTube APIs), so initially there're 0, but then they're 25-30 and at the end of scroll the extra space remaining. So, I don't understand if this behavior is normal (with 25-30 cells). To clarify (maybe my explanation isn't very clear), at the link below there's a short video that I made about my problem. https://dl.dropboxusercontent.com/u/4853483/ScrollVideo.mov
Okay I think I understand what's going on, yes that is a problem that I need to fix. I will work on a solution and get back to you. In the mean time, when your network request is finished and you reload your collection view, set the collectionView.contentInset.bottom = 0
. This should remove that empty space, but I will work on a cleaner solution.
Ok for now it works, thanks!
This issue has been resolved as of version 1.0.1. See the CHANGELOG for more information.
Hi @DevonBoyer ! I try today (with a little delay) new versions... with v1.0.1 this issue isn't resolved for me, and if I set collectionView.contentInset.bottom
to 0 manually, the end of table/collection scroll view remains behind tabbar (even if tabbar isn't traslucent, and this didn't happen with v1.0.0). There're other problems about profileAvatar's position when I rotate device (from landscape to portrait and vice versa, in v1.0 & 1.0.1). But the most important problem is with version 1.0.4: the app crash with this error about DBProfileBlurStageCache that I don't understand:
2016-03-31 22:37:41.340 Tripla Doppia[30644:1740201] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DBProfileBlurStageCache setObject:forKey:cost:]: attempt to insert nil value (key: <DBProfileBlurStageCacheKey: 0x7fe8197e8eb0>)' * First throw call stack: ( 0 CoreFoundation 0x000000010ca4ad85 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010c4bedeb objc_exception_throw + 48 2 CoreFoundation 0x000000010c95fe51 -[NSCache setObject:forKey:cost:] + 401 3 Tripla Doppia 0x0000000107b81b59 53-[DBProfileBlurView updateAsynchronously:completion:]_block_invoke + 441 4 Tripla Doppia 0x0000000107b818dd -[DBProfileBlurView updateAsynchronously:completion:] + 509 5 Tripla Doppia 0x0000000107b810df 25-[DBProfileBlurView init]_block_invoke.75 + 79 6 Foundation 0x0000000108b86f30 -[__NSObserver _doit:] + 304 7 CoreFoundation 0x000000010ca14c8c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 8 CoreFoundation 0x000000010ca149cb _CFXRegistrationPost + 427 9 CoreFoundation 0x000000010ca14732 _CFXNotificationPost_block_invoke + 50 10 CoreFoundation 0x000000010ca5d1e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1986 11 CoreFoundation 0x000000010c90c679 _CFXNotificationPost + 633 12 Foundation 0x0000000108b6acd9 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 13 UIKit 0x0000000109ac3a75 -[UIApplication _stopDeactivatingForReason:] + 992 14 UIKit 0x0000000109acc924 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2725 15 UIKit 0x0000000109ac9714 -[UIApplication workspaceDidEndTransaction:] + 188 16 FrontBoardServices 0x000000010e8018c8 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 17 FrontBoardServices 0x000000010e801741 -[FBSSerialQueue _performNext] + 178 18 FrontBoardServices 0x000000010e801aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45 19 CoreFoundation 0x000000010c970301 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 20 CoreFoundation 0x000000010c96622c CFRunLoopDoSources0 + 556 21 CoreFoundation 0x000000010c9656e3 __CFRunLoopRun + 867 22 CoreFoundation 0x000000010c9650f8 CFRunLoopRunSpecific + 488 23 UIKit 0x0000000109ac8f21 -[UIApplication _run] + 402 24 UIKit 0x0000000109acdf09 UIApplicationMain + 171 25 Tripla Doppia 0x0000000107b3bbaf main + 111 26 libdyld.dylib 0x000000010db9c92d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) Thanks for the support
Hey @francesc-o thanks for letting me know about this!
The reason for this crash was an oversight on my part when I was adding some improvements to blurring the cover photo. I will provide a fix this issue as soon as I can.
I had not tested using a DBProfileViewController
contained within a UITabBarController
so I did not take into account how changing the bottom inset would make the content sit underneath the tab bar. I will have a fix for this problem as well soon.
As for the avatar's position being incorrect during size class changes (i.e. portrait to landscape) this should be working properly as of v1.0.4 since I wasn't able to recreate that issue.
Thanks for your feedback!
Ok, thanks!
Is the crash caused by blurring resolved? Or is there a simple way to removing blurring? Thanks
I just released version 2.0.0 a few days ago. This update was a major update to the library and adds the concept of "Accessory Views" and "Layout Attributes".
In version 2.0.0 it is possible to specify any subclass of DBProfileAccessoryView
to be used for the header or avatar.
DBProfileCoverPhotoView
is now simply a subclass of DBProfileAccessoryView
and is completely optional to use as a header.
The bugs related to blurring DBProfileCoverPhotoView
have all been fixed as of version 2.0.0
@DevonBoyer fantastic job!! It's almost perfect, I have only one question: with DBProfileHeaderStyleDefault for headerView, how can I decrease the cover's height? (with older version there was the coverPhotoHeightMultiplier property)
To allow for more flexibility when specifying sizes for accessory views you can use the delegate method:
profileViewController:referenceSizeForAccessoryViewOfKind:
Alternatively you can change the referenceSize
layout attribute for the given accessory view.
Note that responding to profileViewController:referenceSizeForAccessoryViewOfKind:
will override the referenceSize
layout attribute.
I'm having the same issue. Adding collectionview.contentinset.bottom = 0 only solves the problem temporarily. When switching back and forth from another collectionview with segmentedControl, there is still empty space at bottom. Is there a delegate function that solves this issue?
Excuse me, but I have another problem (the last) that I can't fix. The controller works fine with UITableView, but when I try to add a controller with UICollectionView, at the end of scroll there's an empty space between last cell and the bottom of collection view (see screenshot of my modified demo project). The height of empty space increases in my project (second screenshot), where cells are loaded dinamically. I tried to specify size of footer and header of UICollectionView to 0 and other things, but nothing change. Have you some tricks about this problem with UICollectionView?