I am developing Xamarin forms app and my app seems with safe area set in top. But need to ignore it.
Current scenario:
Excepted scenario:
I have googled regarding this and got below link, tried out as mentioned in below links and nothing worked.
https://forums.xamarin.com/discussion/104945/iphone-x-and-safe-margins-with-xamarin-forms
https://blog.xamarin.com/making-ios-11-even-easier-xamarin-forms/
But didn’t know how to access SetPrefersLargeTitles under Xamarin forms content page in below line mentioned in above link.
On<Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);
After set safe area as true output come as below,
Please help me to resolve this.
Regards,
Cheran
You can do it from XAML like this
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Page.UseSafeArea="true"
Please Refer to Making iOS 11 Even Easier with Xamarin.Forms
We use Platform-Specifics to implement it.
Before iOS 11
On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
iOS 11 or newer
var safeInsets = On<Xamarin.Forms.PlatformConfiguration.iOS>().SafeAreaInsets();
safeInsets.Left = 24;
this.Padding = safeInsets;
It's necessary to create or configure LaunchScreend.storyboard.
Use this code, change splash_screen for your image.
Go to top constraint and make second Item constraint superview.Top
public ItemsPage() {
InitializeComponent();
On<Xamarin.Forms.PlatformConfiguration.iOS> ().SetUseSafeArea(true);
}
Related
I am currently developing a Xamarin.Forms application. I am using IconizePlugin. The app is tabbedPage based and on toolbar I'm trying to include icons for some actions.
This is whay I'm getting:
Icons are showing well and in Xamarin.iOS gets the click event, while it is not working in Xamarin.Droid.
I included the corresponding nugets and followed every steps told in documentation and can't archive this. Other iconize controls in Droid are working fine except the IconToolbarItem.
Please help!
The workaround I found was to declare de IconToolbarItem in the c# code instead of xaml. Although I don't know why it wasn't working while on xaml.
Declaring the item li
ToolbarItems.Add(new IconToolbarItem
{
Icon = "fa-plus",
IconColor = Color.White,
Command = new Command(this.addBono)
});
Before upgrading to XCode 8 and subsequently Appium 1.6 and IOS 10 for some appium tests, I used to be able to use the below XPath to capture the main text in an alert.
#iOSFindBy(xpath = "//UIAAlert/UIAScrollView/UIAStaticText[2]")
private MobileElement alertText;
However something has changed and this no longer works. I would still like to be able to assert on the alert text and don't want to use the IOSMobileCapabilityType.AUTO_DISMISS_ALERTS capability.
Has anyone found a way to get at the alert text?
Bonus question: Where is all this XPath documented? I found it on some random forum, but I can't find any official documentation or figure out how it relates to a captured View Hierarchy in XCode.
Answering my own question in case it helps anyone else.
Due to the appium inspector not working with XCode8, the best way to print the screen layout XML is just to do a System.out.println(driver.getPageSource());
Then you can follow the structure and do something like
#iOSFindBy(xpath = "//XCUIElementTypeAlert//XCUIElementTypeStaticText[2]")
private MobileElement alertText;
I got that from this question: Finding elements by xpath in Appium using XCUITEST driver
Hello Everyone I want to share the Text on Xamarin Form using Library plugin.share. I have successfully implemented the library and on android i can able to share the text but in iOS it returns me nothing. i have done the share code on button click event so when i click on button in iOS its doesn't returns me anything.i tried the Below code but doesn't got succeed
CrossShare.Current.Share("Hii alll", "Share");
please help me to get out of this,thanks in advance
You want to take a look at UIActivityViewController, you can find the documentation here https://developer.xamarin.com/api/type/MonoTouch.UIKit.UIActivityViewController/
And Xamarin.Forms specific example http://devcenter.wintellect.com/jwood/implementing-sharing-in-xamarin-forms
This is a bit old, but I was having a similar issue and was able to resolve it.
First of all, you need to add the plugin Plugin.Share to ALL Xamarin.Forms projects (Portable, iOS, Android, UWP).
In the class that references the share code, add...
using Plugin.Share;
using Plugin.Share.Abstractions;
CrossShare.Share() doesn't work with strings, directly. You need to new up a ShareMessage.
var title = "Title For The Share";
var message = "Text to share.";
await CrossShare.Current.Share(new ShareMessage { Text = message, Title = title });
I can't say specifically to iOS, as I don't have a Mac and can't test that project, but Android and Windows 10 is working.
I'm trying to implement the OpenTok SDK into Nativescript and I've run into an issue that I can't seem to wrap my head around.
Per their documentation (https://tokbox.com/developer/guides/publish-stream/ios/#create_publisher) once you create a publisher object you call:
[self.view addSubview:publisher.view];
I can't figure out how I would tie this into Nativescript, if it's even possible.
My first thought is that I would want a UIView or View element on my page in the XML, then I would call .addView(publisher.view); on that element.
There is a similar question here (Inject pure Java / Obj-C code in NativeScript App) but nothing came of it, the one answer does't provide much help.
I cloned one of OpenTok's sample projects and added their implementation of this call into a gist here: https://gist.github.com/bondydaa/2db355ed45b7e50e4071
You can see at line 117 how they implemented this call. This code raises another question for me in that I'm not sure where _publisherView comes from.
Any help would be greatly appreciated!
In Nativescript you can try calling the 'ios' property of the container you are trying to add the component to. This will return the native object.
For example if you have a StackLayout, you can:
var stackLayout = args.object.getViewById("theIdOfTheStackLayout");
stackLayout.ios.addSubview(publisher.view);
I am upgrading old code to latest iOS8, I see lots of this:
if (controller.modalViewController
&& controller.modalViewController.parentViewController == controller)
if(tabcontroller.modalViewController) ....
I see lots of documentation about how to present a modalViewController, but not for when its a property like above code. What's the equivalent of above code in iOS8?
THanks
If you look at the documentation, it says:
modalViewController (iOS 6.0) The controller for the active presented
view'that is, the view that is temporarily displayed on top of the
view managed by the receiver. (read-only)
Deprecation Statement Use presentedViewController instead.
That's probably a good place to start.