How to create an immovable TableView? [duplicate] - swift

This question already has answers here:
Preventing UITableView from scrolling?
(2 answers)
Closed 6 years ago.
I would like to create a Sign Up page in my application and I want to create an immovable table(witch you can not scroll). I'm doing this in Swift language, if somebody knows will be very helpful. Sign Up Page

In the inspector window of the tableview storyboard turn off anything related to scrolling. And then just make sure your table view height does not exceed the view height

Have you tried setting the bounces property to NO?

You can use the following code:
tableView.bounces = false
tableView.scrollEnabeld = false

From https://stackoverflow.com/a/5344072/4882590
You can do that from your XIB as well as programmatically.
From XIB:
Just select the tableView and in Inspector uncheck bounce horizontally & bounce vertically and scroll horizontally and scroll vertically
Programmatically:
If you want to do that programmatically then you can try
self.tableView.scrollEnabled = false
OR
[self.tableView setScrollEnabled:NO];

Related

How to remove scrollview sidebar swift [duplicate]

This question already has answers here:
How to hide scroll bar of UICollectionView
(3 answers)
Closed 2 years ago.
I am creating a swiping controller from collection views in my app, but one problem I am having is I am not able to get rid of the thin rectangle that appears whenever I swipe from one collection view cell to the next. The rectangle I am talking about also appears whenever you are scrolling in a scrollview. I am not sure what the proper terminology for this is however I would really appreciate it if someone could help me understand how to get rid of this.
if you are using StoryBoard uncheck Show Horizantal Indicator and Show Vertical Indicator
And in code you can do
scrollView.showsHorizontalScrollIndicator = false
scrollView.showsVerticalScrollIndicator = false
Have you tried:
myCollectionView.showsHorizontalScrollIndicator = false
myCollectionView.showsVerticalScrollIndicator = false
Those properties are inherited of UIScrollView

How can I stop the UITableView over scroll at the top and bottom?

I am using a UITableView with UITableViewCells and I want to stop the "over" scroll that you get at the top and bottom of the list, The bit where you can pull down on the very top cell to show the background (sometimes used to refresh) Is there anyway to just make the top edge of the cell the "absolute top"? so the view only ever shows just the cells?
Since UITableView is a subclass of UIScrollview, it should suffice to just set the 'bounces' property to NO.
Edit: you probably need to set'alwaysBounceVertical' to NO, too...
You can use this code to solve your Problem
self.objBackTableView.bounces = NO;
And used Below code to if data is fit on screen than its not scroll
self.objBackTableView.alwaysBounceVertical = NO;
You can set the tableview bounces property to NO.
Swift 4.2:
It's not scroll at all:
tableView.bounces = false
It's not scroll if there is enough space for cells:
tableView.alwaysBounceVertical = false
Hope to be useful.
Interface builder
Select table view in Document Outline on left side
Navigate to View Inspector on right side
Uncheck Bounce Vertically

Status bar tap should scroll table view to the top [duplicate]

This question already has answers here:
How to detect touches in status bar
(11 answers)
Closed 9 years ago.
Can anybody please tell me how to implement tap on status bar and table view should scroll to top. I also have another scroll view in that view controller for some different purpose.
Thanks in advance
If you are having more than one scrollview inside the viewcontroller, you set setScrollsToTop property to YES for the scrollview you want to scroll when user taps status bar. And also set that property to NO for all other scrollviews.
If there is only one scrollview/tableview, You don't even need to do this. It will be set automatically.
[myScrollView setScrollsToTop:YES];
[otherScrollview setScrollsToTop:NO];

Cannot freeze the table header while scrolling the rows? [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Some Gap remains between Table Top and Table Header only when table loads and scrolled down to the last row?
I am using Xcode.
self.mytable.tableheaderview=label;
By this code I can get the header but I can not freeze it...plz help
The best thing to do is create a UIViewController which is a UITableViewDelegate and UITableViewDataSource, and have a UILabel at the top of the UIViewController's nib, and a UITableView underneath the UILabel. This will have the effect of having the UILabel staying put in its position, with the UITableView still able to scroll like normal. Hope that Helps!
This question sounds a like one I just answered here. All you should have to do is set yourTable.bounces = NO; in your viewDidLoad function. Either that or uncheck the "Bounces" option in the NIB if you used Interface Builder to layout your table.
What do you mean by freezing? If what you think is to stop it from scrolling while scrolling the rows of the table, I don't think its possible. See the table header is part of the table view and is designed to scroll along with the rows. If you just want a header that is static, dont make it a table header. Just add a view or label separately and place it above the table view. The table view will then scroll below that.

Horizontal scrolling UITableView [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Horizontal UITableView
I need to make a UITableView horizontally scrollable. I have a custom table with width of 600 and as this is too larger. That table needs to be scrollable. How do I do this?
have a look at this https://github.com/alekseyn/EasyTableView
This should solve your problems.
For anyone who runs across this question, contrary to some of the other advice provided, horizontal scrolling of a UITableView is possible and is not a violation of the HIG. If it was, why would Apple provide the ability to scroll horizontally at all?
The way to get this to work correctly is to only set the ContentSize, not the FrameSize. I am a MonoTouch programmer, so I am not sure what the exact equivalent in objective-c is, but the way we address this is to create a custom class inherited from UITableView and override the LayoutSubviews method. In this method, we calculate and set the current ContentSize.
This approach catches all of the potential cases that we have found where the ContentSize could be reset, including rotating the device, scrolling, and zooming.
CGRect frame = tblView.frame;
tblView.transform = CGAffineTransformRotate(stressTblView.transform, M_PI / 2);
tblView.frame = frame;
What you want to do is use a UIScrollView and fill it left-to-right with "cell"-styled views.
I don't think you can make a UITableView scroll horizontally. My suggestion would be to use an UIScrollView. UIScrollView is a super class of UITableView and gives you the scrolling behavior you expect from a UITableView. What you don't get is the table cell management that makes UITableView so convenient. Hence, you have to manage your own content. It is a little more work, but you get more control.
I don't think that scroll horizontally is a good idea and probably violates the Apple's HIG.
Table view should not necessarily provide all the information but rather just some of the most important information, to view the information that requires a lot of space I suggest you do a detail view.