I need something like a UIScrollview with flexible pageWidth.
As an example; my scollview has 5 buttons. The middle button is the widest. 2nd and 4th buttons have a smaller width. 1st and 5th button are the smallest in width.
| button 1 | button 2 | button 3 | button 4 | button 5 |
How can I build something like that within a UIScrollView with paging enabled?
If i got your requirement right then please read the following blog post (Alexander Repty) regarding this very topic! It's an older entry but it describes the approach well. In short, it's not as simple as just changing the width of the "page" but managable!
Alternatively check out this post also.
Related
I have a list of 12 images that I would like to display on the screen, however I would like to cap the number of images that can fit onto the screen at 9, with the user having to swipe left to see the remaining 3 images.
I have currently hardcoded it, but I would like to know if there is a way to write it such that a maximum of 9 images will automatically resize themselves to fit onto the page, with future images being shown on the next screen, which the user can swipe to.
e.g. In the future if I have 25 images, first 9 will fit themselves onto the first screen, user can swipe to the second screen to see the next 9 and user can swipe again to see the last 7 - without hardcoding 9, 9, 7 per screen respectively.
You can define a screen that takes the list of images to be shown and the starting number in that list.
Images can be shown with a GridView Widget.
So for your example of 25 images:
ShowImagesScreen([image1, image2 ... image25], 0) will show the screen with the first 9 images, the 0 indicates that the screens starts with the first image (index 0 in the list). Swiping on that page will result in going to the next screen. Which is the same screen widget:
ShowImagesScreen([image1, image2 ... image25], 9) this time showing image 9 till 18. Swiping on this screen can go to previous page or to the next:
ShowImagesScreen([image1, image2 ... image25], 18)
On the screen you make logic to disable swiping back or forward when it is the first or last page respectively. You also need to check the length of the list on each page and check whether you are at the end.
I am running into a problem with layout groups in Unity that I do not understand and was hoping for some insight.
My goal is to create a 12 button keypad contained in the bottom half of the screen of a mobile device that would look something like this:
123
456
789
-0-
My approach to this was to use a vertical layout group to first split the screen into a top half and bottom half and then use another vertical layout group on the bottom half to make 4 rows. Each row would have a horizontal layout group with 3 buttons. The problem I am running into is that when I add the 4 rows into the bottom layout group (bottom half of the screen) it starts to automatically expand and ends up taking up much more than just the bottom half of the screen. In the end I just want the 12 buttons contained in the bottom half of the screen and I keep toggling and playing with child control and force expand but do not understand why the automatic resizing is happening. Any insight would be greatly appreciated, thank you, and wishing you a great day
Just use grid layout group that would solve the problem
I think you can use grid layout and make the fixed column count and get the center layout, and use this github https://github.com/mrbeardy/BeardyGridLayout, I get it from unity forum
Hope you like it :)
I wanted to know that how do I make the below page where the footer(Like, Comment, Share, Shave) remains in the bottom till the length of the content and when the content is over while sliding the footer(Like, Comment, Share, Shave) slides up with its own content.
as shown in the below 2 images.
Please help.
I am trying to implement a form much like the iPad's Data Plan Registration form. I am having a problem creating the vertical separator between my form's Labels and Fields. In the example below I'm trying to implement the vertical field/label separator in each section. Thanks for any help. I've searched the forums and looked at lots of tutorials, but have found none that address this specific question.
My Example will be weak since I'm not allowed to post an image...
Using UITableView...
---------------------------------------------
First Name | UITextField
---------------------------------------------
Last Name | UITextField
---------------------------------------------
Thanks again for reading this post.
GuyT
Per the recommendation from M42 I wanted to provide the answer that I used for my question.
My solution comes by using UITableViewCellStyle set to Custom. To implement a custom layout, first you will need to create a PNG image 5px x 200px to create a vertical separator line. When creating the image, be sure to choose a line color that will match the UITableView Cell Lines. Once created, add the PNG file to your project and then customize the cell layout by adding a UILabel, a UIImageView and a UITextField. Set the UIImageView's image property to the image you created. Be sure the image view reaches the top and bottom edge of your cell lines.
how do I make the minimumFontSize property work for a multiline label. The documentation says it must have 1 line. Are there any workarounds. I have label with a primary purpose to display short texts like this: -20% or +30% etc, but this is not enforced and there are ocasionally longer texts like Free cookies and I want to resize font but also have multiple lines. Like this:
+----------+
| Free |
| Cookies! |
+----------+
The label must always have the same size because it is transparent and has a fixed size image underneath it. Is it possible? The part where the users enter these data is not under my control, it is a web app, and I'm an iPhone using a webservice. This is still short enough for web but not for iPhone. Thanks in advance.
Have a look at Resize Multi-line Text to Fit UILabel on iPhone, this might help.