Xamarin iOS auto resize view - c#

I'm getting started with Xamarin using Visual Studio 2013 trying to build an iOS app. I have added a launch screen as an XIB file and the default one they give you (as per the tutorials) just has a few labels and when run on the simulator appears fine.
In the designer when I double click on the XIB, the app view to add components to is square, rather than rectangular and vertical as I would expect for an iPhone display. But the default XIB seems to work.
However I have added a UIView and an image to this, told it to fill the width and height, added two labels in the middle and run it. The displayed image is square and goes off the screen of the simulator, as do the labels. It is not automatically resizing to fill the displayed screen as I would hope.
Basically what I want to know is how to start building basic views with resizable components that will work on any device you use. Can anyone please link me to a tutorial for this using Visual Studio Xamarin for iOS as I don't know what to search for.
What it looks like in designer
How it comes out in simulator

Related

When I set the direction of xamarin forms flyout page to RTL, a gap appears between the side menu and the mobile screen, how can I remove it?

enter image description here
I want to remove this gap shown in the image below, I want it as if it was on the left side without a gap.
Updating the Xamarin.Forms nuget to 5.0.0.2515 in both shared and Android projects has resolved the issue.
I too faced the issue when trying to set flyout page flow direction to RTL in Tab, where it worked fine in mobile device.
I guess the issue has been fixed in the Xamarin.Forms - 5.0.0.2515

Why some elements of xamarin has a "shadow" when creating page?

I'm using xamarin to build an app android and ios and have noticed that some buttons, webviews and some other elements has a kind of shadow while page is being created and then this "shadow" disappears and everything is fine. It seems to occur with transparent elements and I could fix it by giving negative padding or margin, but it's really annoying and not elegant solution. Does anyone here knows what is happening? I almost forget, this tests are being performed on android, I don't know yet if iOs has same issue.
You guys can see below, the "shadow" is at right of the button(it has transparent background):
After Android 5.0, the default button control on the system will have a shadow,if you don't need the shadow .you could define in your activity theme like below :
<item name="buttonStyle">#style/Widget.AppCompat.Button.Borderless</item>

Xamarin Forms - iOS - change splash screen depending on screen orientation

I have a problem with adjusting splashscreen in Xamarin Forms iOS project.
I'd like to change splashscreen static image depending on screen orientation.
In Android I simply, created drawable-land folder, put there image for landscape orientation and it's working.
In iOS project there is whole designer for purpose of creating launchscreens, but I can't find anything that will do the job. When I adjust image for Iphone, change orientation in designer I can't simply put there different image because it's shared across all screens in designer.
One important remark - I found some sources on how to achive that, but for native XCode designer, I need an answer for Visual Studio or VS for Mac.
Thanks in advance
Here whatever you apply, will be applied to landscape and portrait universally.
You can have different images, one for portrait 'splash_portrait.png' and one for landscape 'splash_landscape.png' in Assets.
You can then choose which image to display for landscape and which for portrait using Edit Traits button on the bottom right corner in your screenshot.
Landscape uses Any or Compact Height size class, so you would be selecting Compact Height checkbox and whichever change you apply, will be applied for this size class (landscape).
Please get more details on this, here & here
Practically, I haven't tried as while giving answer, I am away from computer. But I hope this will help.
https://www.youtube.com/watch?time_continue=1&v=y3lspdPxc6o,
Refer this tutorial video by Kym Phillpotts - Xamarin University Lightning Lecture.
On the widget properties, you have an option for the full-size splash.

why i cant move android app buttons in visual studio with mouse ? in android studio its possible

When I want to move my button with mouse I can't in Visual Studio but in Android Studio it is possible.
Can someone help me to move my buttons with mouse in Visual Studio? I'm using relative layout and still the button can't move.
Xamarin does not support rearrange controls from the designer like android studio.
You have to do that from Xaml code. Try to understand how layouts works on android.
This link will be helpful while explains how to design your GUI using layouts Horizontally, vertically and relative layouts.
Using the Android Designer
So mainly, you have to divide your GUI with layouts and arrange the controls inside. Not moving them to a specific location by mouse.
In addition to that, it's a good practice to learn Dealing with sizes which will show how to use Pixels, points, dps, DIPs, and DIUs for better arranging using margin and padding. And weight attribute is really helpful when arranging the controls

Xamarin.Forms.Maps does not load

Working with maps on my xamarin forms project and when i start the simulator i get the map when it is zoomed out, but when i click a button (that moves the map closer, zooms it in) the map doesnt load, it remains gray. The simulator I am using is iPhone 6s. If I however use the iPad Air simulator, it works just fine and the map loads when it gets more zoomed in.
When I deploy the app on my phone it remains gray as well. If I zoom out again, then it loads, but if i go futher in into the map then it turns gray again.
I use Location always in usage + when in usage and the standard iOS map.
I use version 2.1.0.6529 on both Xamarin.Forms.Maps as well as Xamarin.Forms in my mainfolder and the iOS folder. (Latest version)
I have "Xamarin.FormsMaps.Init();" in my appdelegate.cs file as well as some other code (push notifications), might that interfere somehow?
I am very confused what the issue might be.

Categories