xcode - TableView rows from bottom to top - ios

For my little project, I need you help.
I already created a functioning table view. Now I want that the rows goes from bottom to top and not like usually from top to bottom. How do I do that?

First you rotate your UITableView 180 degrees upside down, and then rotate your individual cells also upside down.
Take a look: UITableView anchor rows to bottom

If you can target iOS 6+, this answer suggests using UICollectionView to lay out rows in reverse order: https://stackoverflow.com/a/23895000/144088.

The most simple solution,
you can use array.reversed() to show the last object of the array at the top of tableview

Related

UIPageViewController with 4 direction scrolling

I have created a grid view with the some images on UIView, which should like default iOS Photos app Collection [Screenshot attached]
When clicking on an image, it should show the full image in a screen with UIPageViewController
i added the FullImages with UIPageViewController but it is only two directional, i can only scroll from left to right and right to left OR top to bottom and bottom to top, But i want to do both at a time
for example:
I have 9 images in the following order
1 2 3
4 5 6
7 8 9
suppose i'm at image 5
if i scroll from top to bottom i have to go to image 2
now, if i scroll from bottom to top i have to go to image 5
now if i scroll again from bottom to top i have to go to image 8
now if i scroll from right to left i have to go to image 9
now if i scroll from top to bottom i have to go to image 6
now if i scroll from left to right i have to go to image 5
can somebody suggest how to achieve this?
can i use the UIPageViewController or any other control to get this effect
I would use UICollectionView for Grid layout for photos.
You can't set both dimension scrollability of collection view. But you will achieve this by using Multiple Section
As an example :
I think you need something like this.. Just remove First Row & Columns. & add ImageView instead of Just Text..
http://www.brightec.co.uk/ideas/uicollectionview-using-horizontal-and-vertical-scrolling-sticky-rows-and-columns
Another good eg is: https://github.com/izotx/ScrollableCollectionView
& if you want to load view at the middle photo of grid then set ContentOffset of that collectionview accordingly..
As far as i understand your problem, this solution should work in your problem..
Try this out & inform me if you solve it or not. Or you get another best solution..
A UIPageViewController will not do what you want. Think of it like a book. That's what it offers. It won't offer scrolling through a grid of pages like that.
A customized UICollectionView is probably the best starting point for what you want.

I've added a view within a UITableView and there is a gap between the view and the first cell. How can I remove it?

I've added a view to a tableView and there is a gap between the view which is 44px high and the first cell.
Here's a screen shot from IB:
I've tried a few things such as changing the heightForHeaderInSection's value and also disabled adjust scroll view insets. None of these work properly. The view seems to be within the tableView and scrolls with it.
This is how things are looking in simulator:
Would appreciate some help here as I don't understand what exactly is causing this gap.
Thanks for your time
A great way to debug these types of problems is to set a background color. You could set the cells to red and the view to green. It would then be interesting to see if the red and green edges are flush with no white in between.
Based on your screenshot, it looks like nothing is wrong. And by that I mean it looks about right for a view height of 44 points and a cell immediately beneath it with no separator line above it (so it's hard to tell where one ends and the other begins).

Simple way to stagger cells in UICollectionView

I am working on an iOS app that has a UICollectionView. I would like to make a simple custom layout in which the middle cell on each row is slightly lower than the one on the right and left. I've been looking over tutorials and the apple documentation but most of it is for a much more complicated set up.
Is there is a quick way to stagger the middle cell. Thanks for any input!
Currently the collectionView looks like this...
I simply want the center cells shifted down by 40 pixels or so.
Subclass UICollectionViewFlowLayout and alter the response that the superclass gives so that the cells are positioned where you want them.
Here's an example of a UICollectionViewFlowLayout subclass:
https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/bk2ch08p466collectionViewFlowLayout2/ch21p748collectionViewFlowLayout2/MyFlowLayout.swift
It shifts the cells left (so that they are left-justified instead of full-justified across the screen). It is not difficult to see how to adapt this to shift certain cells down.

Manipulating scroll view in Corona SDK

I have a class with a scroll view that has a width of 980. I also have about 100 buttons aligned 5 columns x 5 rows for each 320 width of my scroll view. The scroll works okay but I'm trying to achieve two things:
Allow scrolling only when slide length is about 50% of screen size
If the slide length is half the screen size, then it would immediately slide/scroll to the next 25 items. For example, in plain sight you would see buttons 1-25 then if you try to scroll, the next 25 objects would be displayed (buttons 26-50).
I followed the sample from here but I don't know how to implement what I want to do or if it's even possible to do this using scroll view. I hope someone can give me a good example or idea. Thanks.
Try something like this: http://developer.coronalabs.com/code/slider-module-springboard-functionality-warning-shameless-promotion-inside. It works sort of like the iOS springboard.

Table cells scroll past table boundaries iphone ipad

I have searched all over but have not found any answers or even a question like this. I have a UITableView. When I load the table everything seems ok. However, when I start scrolling vertically the cells go past table boundaries on both top and bottom of the table. In case of the top cell, it only disappears off the screen once the bottom of the cell reaches the top of the table. Same thing happens on the bottom of the table. See image below. This happens in both iPhone and iPad app. Any help would be greatly appreciated!
Try setting:
tableView.clipsToBounds = YES;

Resources