I am attaching an image. Some of you might have tried this iphone application before. It is a screen shot from Awesome Note. How do they achieve the 5 rows table view, with a swipe to next page for more rows?
Basically the UITableView (at least I think it's a TableView?) is confined to the bottom half of the UIView.
Any swipe to the left or right jumps to the next page and you see the next 5 rows (if any.) We can see from the screenshot that there are at least 11 rows, since it's 3 pages in depth.
Is this achieved using a TableViewController inside a UIScrollView or something? I've setup my own custom TableViewController, along with a UITableView. Inside interface builder when I check Attributes section for my UITableView I see an checkbox for Paging Enabled, which I've ticked.
I've also disabled Vertical Scrollers but this seems to have no effect? I'm obviously missing something, seeing as I haven't even seen where I can define how many rows / sections I'd like to render on one page before another page is created.
Any help would be appreciated.
Thanks!
Thats not a UITableView, thats a UIScrollView with custom buttons.
The Paging option is because UITableView is a sub-class of UIScrollView.
If there are only 5 items, it's better to use 5 overlapping UIButtons
Related
I realize variations of this question have been asked, but I'm having trouble connecting the dots into a coherent solution for my problem. So here's my scenario:
I have a UITableView that has 2 sections. Section 1 has no header view, and 1 cell. Section 2 has a header view (it floats as is the default behavior with plain table views), and 1 cell. This solitary section 1 cell has a horizontally paging scrollview with 3 pages. Each page is a tableview. This sounds a little nutty, but it is totally legal and makes perfect sense. My scenario is a user profile screen. Section 1's cell is the user's bio. Section 2's header is a paging menu that shows the three menu options. The pager has three tableviews for all the content a user publishes, follows, and their posts.
The problem is that when the user scrolls any of the inner tableviews in the pager, I want the outer tableview to scroll until the bio is scrolled off screen and the section header hits the nav bar of the view controller. And then I want the inner scrollview to take over the scrolling.
I've been playing with a combination of the UIGestureRecognizerDelegate methods: shouldRecognizeSimultaneouslyWithGestureRecognizer & shouldRequireFailureOfGestureRecognizer. I am able to either scroll the tableviews simultaneously (which, btw, isn't terrible, but it's definitely not my desired behavior) or just enable scrolling on either the inner or outer tableview. I would love to be able to solve this problem using the UIGestureRecognizerDelegate because my gut tells me that the solution doesn't need to involve any delegation and overriding contentOffsets using UIScrollViewDelegate methods like scrollViewDidScroll: and so on. But maybe I'm wrong, and I will have to go that route.
Thought I'd throw this up there before I threw in the towel. Would appreciate any help!
I want to be able to dynamically populate UIScrollView. Like how it is done for row views in UITableView. I have a class that takes in some parameters and creates the respective view when it scrolls. Currently I have 8 views.
These 8 views have different background image, image and label according to the page number it is currently in. However the basic skeleton for this view is the same. What i am doing right now is in ViewDidLoad I am creating 8 views and add them as subviews and scroll over.
I don't want to do this. I want to create three views and the rest i want to populate when the user scrolls a page and then a page etc. How do i do this? ANy pointers/tutorial?
First of all you calculate the ContentSize for the scrollview (when you want to use the iPad in landscapemode with 8 pages then the width should be 1024*8 = 8192px and the height 768px).
Then you should implement the UIScrollView Delegate method:
scrollViewDidEndDecelerating:
In this Method you check on which page you currently are with the contentOffset property of the scrollview and start updating your left and right hidden views..
Hope this helps you a bit.
Check the two most recent WWDC videos for two excellent sessions regarding expert use of UIScrollViews. Additionally you can review a brief tutorial here, written by the well known cocoa expert, Matt Gallagher.
I have noticed in the iTunesConnect iOS app, the first and last cells of the grouped UITableView stay on screen even though the other cells are scrolling through them. They also move with the tableview. For example when scrolling to the bottom of the table (moving up), the last cell moves up with the table as it leaves the bottom of its position on screen.
Does anyone have an example of how this could be done? I have tried setting the header and footer views but these scroll off screen when moving the tableView.
Thanks.
I think the best approach would be to use a plain UITableView with Header and Footer set, and "skin"/theme your custom UITableViewCells to look like grouped UITableViewCells.
you'd might want to have a look over here for some pointers on how to achieve this.
I have a page enabled scrollview on an iPad. On the first page, I have a child scrollview that scrolls horizontally through image buttons. The buttons scroll the outer scroll view to the correct page. Its basically like a table of contents that jumps to the correct page.
My end goal is to be able to categorize the buttons seen in the child scroll view. So there would be a segmented control that changes what buttons you can see. So maybe one category would be ALL, and another category would be A-M, and another would be N-Z for example.
My question is, should I use a uiscrollview or a uitableview?
Right now I use a scrollview and it is really easy to get the buttons in. I could implement the different categories kind of gimmicky by having all of the buttons in the scrollview and then just showing or hiding the buttons accordingly. I feel that it'd be bad memory usage though.
For a uiscrollview i was looking at using EasyTableView, butI'm not 100% sure if this is compatible with what i want to do or if it'd even be better.
Any ideas for what the best way to implement this is? Specifically, I'm not sure of the best way to change the buttons when I change categories.
Thanks!
Use a tableview when you are dealing with data that is best expressed as sections and rows.
I think for your situation I'd have a UIView subclass that can display the images you need for a given category. Stick that on the outer scrollview as needed. You can keep memory low by only keeping the currently visible view and the ones on either side on the scrollview. When you scroll to a new location you can recreate the view needed for that page, and the ones surrounding it. Then you release the ones that are far away and let the system reclaim their memory if needed.
I'm looking for a clean way to implement a login screen in my iPhone application. I'd like it to appear as a grouped UITableView section with rounded corners and a separator line below between rows (like e.g. the sections in the Settings app). However, I'd like to give it a slightly smaller cornerRadius than the default setting of a UITableView section.
Another thing I'd like to do in that screen is to add a "register as new user" button which causes the whole screen to slide up, presenting the registration screen. There will be a background image that spans both screens vertically and should slide up with together with the content.
I was first thinking to just make a UITableView, set it to grouped, add two sections (one for login and one for registration), add some space between them and disable manual scrolling on the UITableView. However, I found that putting a background image correctly behind a UITableView and to make that scroll together with its content is a bit tricky..
Perhaps I shouldn't be using a UITableView and just write some code myself that can wrap multiple views (each containing a label and a textfield) together into something that appears like a UITableView section? I've been searching around but surprisingly it appears that not too many others are trying to solve this same problem.
Any suggestions would be very welcome!
Sounds like a UITableView is overkill for what you need. I would just create a custom UIViewController and have it handle the layout of all of your subviews as well as any animation you desire.
Just have the parent view take up more space than the device's screen. Then, when you want everything to slide up, animate a change to that view's frame property.