Basic4Android - Fill ListView and ScrollView after screen rotation - basic4android

how can I save the ListView and ScrollView items that contain text and images, in order to restore them after screen rotation? The data are imported on run-time.
Thanks in advance

Declare your ListView and ScrollView variables in the Sub Globals event. Load them in the Sub Activity_Create event when you load your layout, and they should just work.
If this isn't what you wanted, edit your question and provide more details (including the event code that's loading your data) to provide more info.

Related

How to load only items that are visible in scrollview

I have a long list of items I need to load in scrollview.
Currently I'm iterating over the list and adding it. But since the list is long the scrollview is extremely slow when loading and scrolling.
Is there a way to only have the items from the list that are suppose to be on screen loaded instead of loading all items?
Or is there another technique that can be used?
Use this.
https://github.com/Mukarillo/UnityDynamicScrollRect
Its a custom scroll view someone wrote that only loads the visible elements. You just have to write a custom function for instantiating the elements

TableView Cells to Fill Screen Swift

I have a dynamically created tableView in XCode which generates cells from an array. Currently, the cells do not fill the entire screen, that's to say that there are empty rows beneath them. How do I get them to fill any screen size for any iOS device at any orientation, please? Also, in another tableview, more array items populate the table - but then I can't scroll to view them all. How do I enable scrolling in a tableview?
So, in summary, how can I get my populated cells to fill the screen of any iOS device? And, how do I enable scrolling?
Thank you very much :) I really need help!
I am unsure of what you are asking because you haven't supplied enough information to determine exactly what task you are attempting to complete. Can you be more specific about what you are trying to do?
I can advise on your request for how to scroll, though. If you want to scroll, you'll have to nest the TableView as a child of a parent ScrollView. You can enable scrolling in the ScrollView, which will then allow you to scroll through the content in the child TableView.

How to lay out scrollable iPhone view

I need advice on the most pragmatic way to layout the following view. As you can see from the image attached, I have a static logo and text that appears at the top of the view, followed by a variable number of items.
Initially, I was going to use a TableView for the variable number of items, that way I would be able to load any given number of cells at runtime.
My problem is that if I drop a tableView onto this view below my static logo and text, when the user scrolls, the static logo and text will remain fixed. I need both the static logo/text AND the tableView to scroll up.
My next inclination is to use a scrollView, inside which I would place my tableView and static logo.
Is this the most pragmatic way to approach the problem? If so, will there be usability issues when scrolling the scrollView vs scrolling the tableView? In my mind this could get messy.
Any advice on the best way to approach this is greatly appreciated.
Using a table view inside of a scroll view is a bad idea and warned against by Apple in their docs. Basically the internal gesture recognizers can conflict and create a clunky user experience. The best path forward would be to go with the tableview (which is a subclass of scroll view) and have two different kinds of cells– one for the logo and one for the repeating contents at the bottom. Make the first cell the logo and adjust the table view's settings to format it to your heart's content.

Auto position sibling UIViews

I have 4 UIViews stacked in a UIScrollView.
When any one of the UIViews are tapped, I want that particular view to expand and show some more content and this would mean the sibling views below the selected view has to push themselves down.
I could have used UITableView but there are all kinds of weird stuff happening when you change the row heights dynamically which is why I chose this fallback.
Can I use autoresizingmask to do this ?
Cheers
Your question Answer is not so simple,you Need to use Different Logic Means You know how Much Width and Hight your Each view have after Clicking on it and then you can pass the reference of View to setContentSize of Scrollview.here is some tutorial which solved my problem when i was putting some run time data in Scrollview.
link
link
Hope it will be helpfull for you.

Dynamically loading hi-res images into UIScrollView

I've been looking into creating a gallery mode in my application.
The functionality will be identical to the built in Photos App.
Here's the flow:
1. You touch on a thumbnail and ...
2. a modal view displays a large detail version of the image
3. You have the ability to scroll horizontally through all the images in the gallery while in this modal view
I'm stuck on step 3.
How do I dynamically load hi res images into a scroll view? I understand I need to set the contentSize for the the scrollView but how do I do that when I've only selected and loaded one image? What delegate methods do I need to implement and what does the heavy lifting look like?
Thanks in advance!
Refer to the following example project from apple, it shows how to use a scroll view to scroll horizontally through some views, u shouod only need to change the conents of those views to contain ur images http://developer.apple.com/iphone/library/iPad/index.html#samplecode/PageControl/Introduction/Intro.html