0
これは私の画面がどのように見えるのかです。最下部にUIToolBarがあり、そのUIBarButtonItemが含まれています。それは、iOS 11.iOS 11:UIToolbar内のUIBarButtonItemがその場所から外れます
前に前に罰金働いていた。しかしiOSの11で、UIBarButtonItemは、その場所を示しています。これはステータスバーに表示されています。シミュレータでは正常に動作しており、ツールバーの中に表示されます。しかし、iOS 11を実行しているiPhone 6でこれを実行すると、下の画面のように表示されます。
ここでは、コード..
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
UIBarButtonItem[] bArray = {
getSetAsHomeButton(apiCall, this, 0),
new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace)
};
SetToolbarItems(bArray, true);
}
public static UIBarButtonItem getSetAsHomeButton(ICommonApiCall commonApiCall, UIViewController controller, int status)
{
var view = new UIButton();
view.Layer.CornerRadius = 8;
view.BackgroundColor = UIColor.White;
view.TranslatesAutoresizingMaskIntoConstraints = false;
view.WidthAnchor.ConstraintEqualTo(108).Active = true;
view.HeightAnchor.ConstraintEqualTo(32).Active = true;
var HomeIcon = new UILabel (new RectangleF (0, 0, 21, 21));
HomeIcon.Font = FontAwesome.Font (22);
HomeIcon.Text = FontAwesome.FAHome;
HomeIcon.TextColor = PlatformConstants.PrimaryColor;
var HomeLabel = new UILabel (new RectangleF (25, 0, 64, 44));
HomeLabel.Text = "Set as default";
HomeLabel.Font = UIFont.FromName (PlatformConstants.PrimaryFont + "-Medium", 11);
HomeLabel.TextColor = PlatformConstants.PrimaryColor;
HomeLabel.Lines = 0;
HomeLabel.SizeToFit();
view.AddSubview (HomeIcon);
view.AddSubview (HomeLabel);
HomeIcon.TranslatesAutoresizingMaskIntoConstraints = false;
HomeLabel.TranslatesAutoresizingMaskIntoConstraints = false;
var hSpaceLeading = NSLayoutConstraint.Create (HomeIcon, NSLayoutAttribute.Leading,
NSLayoutRelation.Equal, view, NSLayoutAttribute.Leading, 1, 6);
view.AddConstraint (hSpaceLeading);
var HomeIconCenterY = NSLayoutConstraint.Create (HomeIcon, NSLayoutAttribute.CenterY,
NSLayoutRelation.Equal, view, NSLayoutAttribute.CenterY, 1, 0);
view.AddConstraint (HomeIconCenterY);
var HomeLabelCenterY = NSLayoutConstraint.Create (HomeLabel, NSLayoutAttribute.CenterY,
NSLayoutRelation.Equal, view, NSLayoutAttribute.CenterY, 1, 0);
view.AddConstraint (HomeLabelCenterY);
var hSpace = NSLayoutConstraint.Create (HomeLabel, NSLayoutAttribute.Left,
NSLayoutRelation.Equal, HomeIcon, NSLayoutAttribute.Right, 1, 4);
view.AddConstraint (hSpace);
var HomeLabelWidth = NSLayoutConstraint.Create (HomeLabel, NSLayoutAttribute.Width,
NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 80);
view.AddConstraint (HomeLabelWidth);
view.LayoutIfNeeded();
view.TouchUpInside += delegate {
SetAsHome (commonApiCall, controller, status, view).ContinueWith (t => Console.WriteLine (t.Exception),
TaskContinuationOptions.OnlyOnFaulted);
};
return new UIBarButtonItem (view);
}
すべてのヘルプは高く評価されます。ありがとうございました。