UICollectionViewLayout issue with the cell resziing - ios

I have checked the solution all over stackoverflow and came across a couple of those to rectify the issue I am facing.
Below are the screen shots of the problem that i am facing while using collectionview in iOS7.
The application is toggling between these two views on every build process. Sometimes it displays the correct implementation and sometime is displays the incorrect one.
Gone through a lot of posts where extension of the custom layout with UICollectionViewFlowLayout was an option along with shouldInvalidateLayoutForBoundsChange and layoutAttributesForElementsInRect. But still the problem persists.
Does someone ran into similar kinda issue? Will be great if you guys can put some enlightment to this one.

I would suggest you try using something like DCIntrospect or simple logging to see what the frames are for your collection view cells and the collection as a whole.

Related

Having issues with auto layout showing up different than preview

I'm trying to follow the tutorial on Apples Swift Tutorial
I've followed the UI layout but for some reason, when I hit play and the simulator pops up, my simulator shows up different than my preview. Any suggestions?
I feel this question may help somebody in the future so I won't bother deleting it.
Through my own stupidity I ended up building the UI under the LaunchScreen.storyboard ViewController instead of the Main.storyboard ViewController. Simple fix -> Put things where it belongs!

Scrolling UICollectionViewCell to background instead of vertical

I'm trying to recreate the Shazam Discover UI by subclassing UICollectionView/UICollectionViewFlowLayout.
I've got as far as paging the cells and making them the right size, however, I'm having trouble getting the cells to scroll to the background, as in, I don't have a clue on how to get it done, I've searched everywhere but can't seem to find it.
An example of what I'm trying to achieve:
Any help/tips on how I could do this would be greatly appreciated.
edit: I ended up building my own solution:
https://github.com/JoniVR/VerticalCardSwiper
You could use third party libraries to achieve the same.
You may use StickyCollectionView. This is an Objective C based library. I believe this one with some customization will help you to approve this.

iOS UI elements are invisible

I work on a project for few days. All worked great until today. I've added few elements to view just like normal today. But when I launch app on device I can't see them. They are there: size classes works ok, everything is on right place. I can even touch UISegmentedControl and pick item on UIPickerView that makes the Picker View noise. But they are invisible - I can see only older elements.
I can't even tell where is the problem, because new elemts have THE SAME setting as olders. Methods like [_someElement setHidden:NO] does nothing.
Can you help me please?
Edit: they are visible in IB Preview
probably bug with cache, try to:
-delete all data from DerivedData folder
/Users/%user name%/Library/Developer/Xcode/DerivedData
-manually remove application from device/simulator
rebuild application
Thank you, I solved it after few hours, when I was focusing on another problem.
AVFoundatuon preview layer hide those elements. Simple solution is to bring them to the top as subviews.
Thank you.

iAd is killing the performance of my app

I've developed an app for iOS with Swift and now I'd like to add an ADBannerView in my tableviewcontroller just to show some iAd banners.
This is what I did :
I linked the iAd framework
In the ViewDidLoad of my tableviewcontroller I have added the following code :
self.canDisplayBannerAds = true
Quite easy! Perhaps too easy, because everything seemed to work fine, the view displayed the ad correctly but... performance was really bad!! My tableview scrolls smooth if I don't show the ad and keeps lagging while the ad is displayed... how come? What have I missed?
Thanks a lot
D.
thanks for your help, I was totally wrong, iAd wasn't the cause of slowness of my app.
I've found the problem (I was setting the font of a textbox inside the cellforrowatindexpath method).
I've upvoted your comments because they were the correct way to find the issue.
thanks again
All the best
D.

Displaying a UIImageview in a UICollectionview

I'm making an app where I have a UICollectionView and I want some collectionviewcells to display an image. What should I do in my code for the UIImageViews to show up? Aside from that, what should I do for my collectionviewcells to show up as well? I looked to a lot of places on the internet and nothing has worked. Any suggestions are appreciated.
I recommend to use PSTCollectionView for showing the collectionview in your view. Download the code and play with it. Read readme.txt for additional information.
GitHub Link
Hope this will help you a lot.

Resources