UICollectionView cells not displaying properly when in parent view controller - ios

In an app for iPad, I have a view controller 'A' with a collectionview that displays differently based on the orientation, i.e. vertically scrolling in landscape & horizontally scrolling in portrait. I have 2 separate uicollectionviewlayouts to achieve this, with different cells registered and everything, which I set when device orientation changes.
The problem is when I push a view controller 'B' in response to clicking the collectionview cells in 'A', say in portrait mode & I now switch the device to landscape mode (while in 'B'). Now on clicking back from 'B' to 'A', the layout of the collectionview has changed to horizontally scrolling, however the visible cells displaying are out of place :( Manually scrolling the collectionview or manually changing orientations (rotate device to portrait & then again to landscape) when back to view 'A' is the only way which makes the cells display properly. I've done everything from invalidating the layouts and setting it on orientation change for view 'B' in view 'A' and even tried all the reloading stuff such as
[self.collectionView reloadData]; as well as
[self.collectionView reloadItemsAtIndexPaths:[self.collectionView indexPathsForVisibleItems]];
However, neither of these work. I'm assuming its because the view 'A' is not visible when view controller 'B' is pushed onto 'A' is causing the issue. I'd like some guidance how to fix this problem as I'm at my wits end.

Related

How to display the entire contents of the a TableView while in Landscape mode

I have a TableView controller, and the tableView cells were added statically.
as shown in the image_1 below, I have 18 cells. but the problem I have now is, when I change the screen orientation to Landscape, the simulator can not display the entire cells inside the TableView controller, it displays only 8 cells as shown in image_2.
please let me know how to display all cells while in landscape mode.
image_1:
image_2:
If you want to fit all the cells, I think, you can either check the current orientation and decrease the cell heights or You always can use collection view and also change the item sizes relative to orientation.

SWReveal View Controller (IOS App development)

I am using SWRevealViewController to show front and rear view. Inside rear view I am using full view Mode and insert table view, but table view cell content is not lies in the middle of screen. it little swap to the right side. I have tried almost every thing, from storyBoard I have used Auto layout and inside cell.m file inside layout subview class but no result.
But when I tap on cell content it appears in the middle of screen, As I wish. please suggest me so if this screen load content appears in the middle of screen of tableview. Your suggestion is highly appreciated. enter image description here
[
you can see how weird it looks
Now I got the answer, we can edit the sw reveal rear width to screen size and same applied to table view size, In this way we can bring the content of tableview in the middle of view enter image description here

IOS UICollectionView with Paging Enabled pushed off center

I have a collection View that is horizontally scrolling. I checked off paging enabled in storyboard. Everything is working fine however when i scroll through the cell on the first and last cell i can scroll just a little extra and move the cell off center. Does anyone know how to fix this?
EDIT
I added a screenshot, the cell is the gray and the white is the collection view background, that acts as a page and when i drag it just a little that the whit is gone that acts as its own page as well, however the cells that arent first or last dont have this issue

UITableView awkward touch issue in landscape

I've a strange issue with UITableView, though I've many tableviews but the problem is with a particular tableview (in a viewcontroller that's the first viewcontroller of uitabbarcontroller).
In the portrait mode everything works fine. But in landscape mode, the right half of the tableview doesn't recognise any touches, and also the scrollview doesn't respond. The tableview and the subview of the cell takes there position as I needed, but the responsiveness of the touch-events is limited to the width that corresponds to that of portrait mode. beyond that the touches are not getting recognised.
And it's not all. The strange thing is that when I open another tab and come back to this starting tab, all works fine. Scrollview starts responding even when touched in the right half, the button in the extreme right of the cell works fine and right half of the textview in the middle of the cell also responds properly.
Though all of three tabs of the uitabbarcontroller have tableviews but the starting, the main, tab shows this awkward behaviour.
The behaviour is same for iPhone and iPad.
Kindly respond quickly, if anyone knows the answer to this problem.

Unresponsive UIScrollView after dismiss modal view

This issue is driving me crazy.
I have a UIScrollView with a content view that doubles its size. Scroll is enabled and contentSize is set. The content view has a pair of UICollectionView side by side so you can scroll the view between both of them (scroll paging is enabled too). Everything works ok until I select a cell. The app presents a modal with some info and, when I dismiss the modalview, the scrollView becomes unresponsive and doesn't scroll (but I still can select the collectionView cells!). It even change the contentOffset with animation to the proper "page" but doesn't scroll at all when dragging.
It sounds like the good old contenSize error but when I log the sizes in viewDidAppear, it has the right size.
FYI: I'm targeting iOS7 and I set the scrollview layout using storyboard with AutoLayout.
Any help will be appreciated
Solved. It seems that the constraints I set in storyboard weren't recreated when the modal was dismissed (I don't know why). Creating the layout by code did the trick.

Resources