I had a problem using a UIScrollView with xamarin.ios
I used the scrollView normally, and everything is going well, but the point is that I can't adjust the tools size"Constraints" inside the ScrollView, for example I have many sizes for ios phone screens, so I don't want to make a specific width and hight for tools, and that what storyboard force me to do.
any ideas, open source or tutorial.. thank you
AutoLayout on UIScrollView is different from UIView.
Refer to my recent answer Auto Layout within scroll view , also a demonstrative demo in the comment.
Related
Hello Mobile developers!
I'm creating an app and I'm not being able to make it scrollable. I've inserted a ScrollView and inside a vertical StackView with 3 Views.
I am new to swift and I'm not really sure what to provide for you to help me, se here's a couple of screenshots that may help.
Running app
View Structure
Some constraints
ScrollView details
Any other comments regarding the structure or good practices are welcome.
UPDATE: The app is now scrolling, but for some reason I'm not being able to scroll the whole way down. It seems like it's grabbing the full hight of the device as height of the scroll, even though the content I'm inserting is dynamic.
I have a video in the following link so you can have a visual reference:
https://drive.google.com/file/d/1UmE9NEVTxbK_rFPJarhfohPFb8XD8HcA/view?usp=sharing
I think the problem is that you haven't add View inside your scrollview and also uncheck "Content Layout Guides" in Size inspector section for your scrollView. That view is your main content View. So your hierarchy will be like ScrollView -> View -> and then your main Stack View. Don't forget to give your main content view any fixed height so it will work perfectly. You can also dynamically handle main content view Height constraint.
You can also take a quick guide from following answer which work perfectly fine.
https://stackoverflow.com/a/59047168/12969732
I hope it will helps. Let me know if you have any query.
I Was create a UIViewControler in storyboard or XIB with autolayout.
When i add UITableView into the view controller it does not support all screens properly even not support to portrait/landscape screens too.
I Have attached a screen of my story board.
I am a Beginner for iOS , so i dont know hoe to set constraints.
Please Some one suggest a best tutorial to done this or provide a simple sample application.
FYI: I am using Xcode 6.1 and Objective-C
Thank you!
It sounds like you're having trouble with adding constraints to a UIViewController.
Here is a good primer on AutoLayout on Ray Wenderlich's site. It's a good way to get your feet wet with AutoLayout in Interface Builder.
Once you do that, consider reading this article about why to not use Interface Builder. I was finally convinced by this article to go the pure-code route, and I've enjoyed the results.
Anyway, for your particular example, here are some screen shots to add the constraints to your UITableView:
When you add the UITableView to your UIViewController, you probably lined it up so that all edges between it and its containing view matched up. In that case, when you click the "TIE Fighter" button (really called the "Pin" button), you should see the following:
At this point, you simply need to click the 4 "struts" to add those constraints to your UITableView. When you do that, they'll turn from light gray to red, as seen here:
At that point, simply click the "Add 4 Constraints" button to finish the job. Your UITableView should now be "pinned" to all 4 edges, causing it to resize automatically during rotation.
I'm trying to create a 3x3 menu, based on a grid of buttons, and I'm facing a lot of problems trying to adapt it to different screen sizes.
Since I want my menu to be equally spaced on the screen (using autolayout tricks on the Storyboard), I have created a custom class with this menu that i'm adding to the center part of the main controller view. The problem is that the menu doesn't fit in small screen (3,5" screens).
Trying to solve this problem, I have created a scrollView in the main screen to add the menu and be able to scroll in small screens.
The problem is that since the view I'm loading in the scrollview, automatically fits to the size of the container (in this case the UIScrollView), only a small part of the menu is appearing in the 3,5" screen, without the option of scrolling (In bigger views it appears equally spaced and everything appears correctly).
How can I solve this UIScrollView problem? Or there is a better solution for this problem?
p.s: I'm sorry, but I don't have enough reputation to add images :(
Uiscrollview with autolayout has some pain into it.
You need to place you're inner views so the scrollview Will be able to understand the contentsize it should use.
You can find more detailed info here
http://infinite-edward.tumblr.com/post/66865604683/uiscrollview-contentsize-and-autolayout-gotcha
I am trying to use a UIScrollView to scroll through a few UIViews but it is not scrolling. I've set it all up in interface builder. Can anyone offer any ideas?
You will need to set the content size of your scrollview in your code. Otherwise it doesn't know how far it needs to scroll. See the Apple docs here for more details:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html
So I have a long form with 11 UITextViews. It's just long enough exceed the iPhone older 3.2" screen so I had to throw it all in a UIScrollView. Now when I rotate to horizontal the UITextViews won't resize to fit the newly available space to the left.
Any ideas about how I can get around this?
First, do you mean UITextFields? (instead of TextViews)
There are many different ways to go about this.
First of, did you use Interface Builder to build the view?
If the view is simple, you can try the elastic positioning provided by Interface Builder, you might have to fiddle with different options.
Another way is to use Autolayout system, available in iOS 6.0+
Or, if you're comfortable with handling frames yourself with codes, you can have different frame sizes set for when the view has rotated.
Or, you can create a separate xib file just for the landscape view and have the program load that xib when the phone rotated.
All of the above are widely used methods for handling rotations, you should choose what fits best in your situation.