Is it possible to have a split table view or do I have to insert a button this large next to each other.
I have tried playing around with this but no luck. I can only get 2 table views which don’t move at the same time.
e.g
Related
I have a project that uses a simple UITableView to represent a month of items. Each row is a day of the month and the table represents a single month. There is a small view at the top of the table view with buttons to move forward in time (Next) and backwards in time (Prev), one month per click. This all works perfectly fine.
What I am searching for is a way to "slide" the current month off and the next/previous month on when the appropriate buttons are clicked. The affect would be similar to using a page view, but there could be "infinite" (indeterminate) number of months forward/backward, so this seems to eliminate using segues, page views, etc.
I have found code to animate the left/right movement of the current tableview, but these don't seem to fit the bill either: I need a "new" table view to move into view as the "old" table view moves off.
The only thing that seems to make sense is:
Create a new table view "offscreen" and populate it
Animate the current table view to move off screen as the new table view is animated moving on screen
Swap "old" and "new" to prepare for the next transition
Seems like a ton of work, which I guess is OK but I'd hate to invest the time if there is a better way. Any ideas?
Thanks!
I'm having the user input four pieces of information into four different UITextField's (homeTeam, visitingTeam, homeScore and visitingScore). I am very new to Swift and am trying to figure out how to connect those four UITextFields so they show in the UITableViewCell's. I feel like this should be very easy but I am very new to Swift.
I have attached an image so hopefully it makes it easier to understand. I want the information from these four textFields to be displayed in one cell of the ui table view so it shows the two teams and the score of the game. Does that help?
image
You can attach 4 IBActions to the 4 UITextFields, that update 4 different variables.
In the table, add 4 label outlets (you can make the table static, and force 4 rows if you want).
Then when you segue from one viewController to the other, pass the 4 variables into the new segue controller, and update the outlets to display the appropriate data.
I'm trying to create an app where multiple lists can be switched between using a button. Does anyone have any advice on the best way to do this, preferably using storyboard (my Swift skills leave a lot to be desired)? Right now I only have one list (a TableView) which is contained in a Container View, along with two other regular Views, one at the top and one at the bottom of the Container View, with the TableView in the middle. I want to have a button in the top regular View that switches between multiple TableViews. I want the number of TableViews to be dynamic, starting with one, but then the user can add additional tables as they need. Any advice on how to set this up would be greatly appreciated! Is it even possible to create a prototype TableView? Is that the way to go here? I've found a couple of Answers on Stack Overflow regarding multiple tables on a single screen, but these lists wouldn't be on a single screen, they would only be viewable one at a time: if you want to see the second list, you have to press the "Next List" button (in the View at the top of the Container View), and the first list disappears and is replaced with the second. Thanks everybody!
Don't change table views, change datasources. Use a single table view as you have it, and one array for each mode that the table is in (call those arrayA and arrayB). Another array-type variable -- call it theModel -- should be set to point to A or B.
The datasource methods will answer the count of theModel, and get values for the cells from theModel. When the user presses the button...
self.theModel = (self.theModel== self.arrayA)? self.arrayB : self.arrayA
self.tableView.reloadData()
// everywhere else, use theModel as the datasource
I am writing a Swift app, and on my main screen I have a long scrollview with several regions of content in it (upcoming events, announcements, and then featured products, and finally some basic info). So it's this really long scroll, and you can swipe down to the bottom.
So visualize 4 boxes, if you will, stacked vertically.
The 3rd box shows featured products. This can be anywhere from 1 to 30 items, depending upon any filters the user has in their settings.
My first try was using a UITableView for region#3 inside of this parent scrollview, but the problem is it only shows the first few items/rows and then the rest you scroll inside the table (which is the default/natural behavior of a table, right?). Unfortunately, the requirement I have is that the inner table can't scroll - it needs to display everything at once and you have to scroll (in the main UIScrollView) to get to the bottom (not scroll inside the inner uitableview scroll). Also, everyone seems to say don't use UITableView inside of a scroll.
So how do I create some sort of list where I create one template (like how you would in a xib/tablecell, and then assign a data source to it, and then repeat down without scrolling? Should I use a tableview after all, and just make the height of it very high and turn scrolling off?
Do I somehow instantiate xibs in a for loop and assign them dynamically to some view?
Thanks so much!
Sounds like you want a Table View with Grouped style. That would make it fairly easy to keep your "4 boxes" segregated, and your "3rd box" would simply be 1 to 30 rows in that section.
On note: you don't want to have a "very tall" table view - or any other type of view, for that matter. You want to allow iOS to manage memory for you, and to load and display only those parts of your content that is visible at any one time.
In other words, use a table view like its designed to be used :)
This question maybe already asked in stackoverflow. But, I did not get any clear idea to my scenario.
I have a viewcontroller (Say, MyViewController).
I have a scrollview(Say, MyScrollView) and I have N number of views (Say MyView1, MyView2, ...) in it.
Those views can be scrolled horizontally. Refer the below image for more clarification.
This image was taken from here.
So, the red area is the scroll view that holds multiple views which are yellow color.
Scenario:
I want to call API's for each view, when the API calling and parsing data occurs, I need to show some loading activity indicator in the views. After successful parsing, I need to update corresponding view with UITableView.
Questions:
In my case, the number of views may vary from 3 to 6. Should I maintain 6 separate UITableViews and UIActivityIndicator's?
I tried with three pointers like left, middle & right to hold reference of tableview and activity indicator. But the problem is, before the first three pages are loading, if the user goes to the fourth view, this system will collapse with so many conditions.
Suggestions needed. Confused!!
I think you have to use UIPageViewController with UITableView. it will solve your problem.