[UIKit] Add Support for DotNet Attributes (#12628)

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
This commit is contained in:
TJ Lambert 2021-09-16 10:22:40 -05:00 коммит произвёл GitHub
Родитель d142a3756f
Коммит c6ab896e6e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 310 добавлений и 2 удалений

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using Foundation;
using ObjCRuntime;
using System.Runtime.Versioning;
#if MONOMAC
using View = AppKit.NSView;
@ -118,13 +119,17 @@ namespace UIKit
}
#if !MONOMAC || XAMCORE_4_0
#if !NET
[iOS (10, 0)]
#endif
public NSLayoutAnchor<AnchorType> FirstAnchor<AnchorType> () where AnchorType : NSObject
{
return Runtime.GetNSObject<NSLayoutAnchor<AnchorType>> (_FirstAnchor ());
}
#if !NET
[iOS (10, 0)]
#endif
public NSLayoutAnchor<AnchorType> SecondAnchor<AnchorType> () where AnchorType : NSObject
{
return Runtime.GetNSObject<NSLayoutAnchor<AnchorType>> (_SecondAnchor ());

Просмотреть файл

@ -117,7 +117,7 @@ namespace UIKit {
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use the 'ShowGlyphs' overload that takes 'nint glyphCount' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
#endif // !NET
public unsafe void ShowCGGlyphs (
#endif // MONOMAC
short[] /* const CGGlyph* = CGFontIndex* = unsigned short* */ glyphs,

Просмотреть файл

@ -13,6 +13,7 @@ using Foundation;
using ObjCRuntime;
using UIKit;
using CoreGraphics;
using System.Runtime.Versioning;
using System;
using System.Runtime.InteropServices;
@ -301,14 +302,26 @@ namespace UIKit {
}
}
#if !NET
[TV (14,0), iOS (14,0)]
[MacCatalyst (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("maccatalyst14.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool UIAccessibilityButtonShapesEnabled ();
#if !NET
[TV (14,0), iOS (14,0)]
[MacCatalyst (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("maccatalyst14.0")]
#endif
public static bool ButtonShapesEnabled => UIAccessibilityButtonShapesEnabled ();
#if !NET
@ -343,22 +356,44 @@ namespace UIKit {
}
}
#if !NET
[TV (14,0), iOS (14,0)]
[MacCatalyst (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("maccatalyst14.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool UIAccessibilityPrefersCrossFadeTransitions ();
#if !NET
[TV (14,0), iOS (14,0)]
[MacCatalyst (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("maccatalyst14.0")]
#endif
public static bool PrefersCrossFadeTransitions => UIAccessibilityPrefersCrossFadeTransitions ();
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool UIAccessibilityIsVideoAutoplayEnabled ();
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
static public bool IsVideoAutoplayEnabled => UIAccessibilityIsVideoAutoplayEnabled ();
#if !NET
@ -441,20 +476,40 @@ namespace UIKit {
}
}
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool UIAccessibilityShouldDifferentiateWithoutColor ();
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
public static bool ShouldDifferentiateWithoutColor => UIAccessibilityShouldDifferentiateWithoutColor ();
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool UIAccessibilityIsOnOffSwitchLabelsEnabled ();
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
public static bool IsOnOffSwitchLabelsEnabled => UIAccessibilityIsOnOffSwitchLabelsEnabled ();
#if !TVOS

Просмотреть файл

@ -2,6 +2,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
@ -9,11 +10,21 @@ using Foundation;
namespace UIKit {
static public partial class UIContentSizeCategoryExtensions {
#if !NET
[iOS (11, 0), TV (11, 0)]
#else
[SupportedOSPlatform ("ios11.0")]
[SupportedOSPlatform ("tvos11.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
static extern nint /* NSComparisonResult */ UIContentSizeCategoryCompareToCategory (IntPtr /* NSString */ lhs, IntPtr /* NSString */ rhs);
#if !NET
[iOS (11, 0), TV (11, 0)]
#else
[SupportedOSPlatform ("ios11.0")]
[SupportedOSPlatform ("tvos11.0")]
#endif
public static NSComparisonResult Compare (UIContentSizeCategory category1, UIContentSizeCategory category2)
{
var c1 = category1.GetConstant ();
@ -27,12 +38,22 @@ namespace UIKit {
return (NSComparisonResult)(long)UIContentSizeCategoryCompareToCategory (c1.Handle, c2.Handle);
}
#if !NET
[iOS (11, 0), TV (11, 0)]
#else
[SupportedOSPlatform ("ios11.0")]
[SupportedOSPlatform ("tvos11.0")]
#endif
[DllImport (Constants.UIKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool UIContentSizeCategoryIsAccessibilityCategory (IntPtr /* NSString */ category);
#if !NET
[iOS (11, 0), TV (11, 0)]
#else
[SupportedOSPlatform ("ios11.0")]
[SupportedOSPlatform ("tvos11.0")]
#endif
static public bool IsAccessibilityCategory (this UIContentSizeCategory self)
{
var c1 = self.GetConstant ();

Просмотреть файл

@ -13,6 +13,7 @@ using Foundation;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
namespace UIKit {
@ -195,7 +196,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (9,0)]
#endif
public event EventHandler PrimaryActionTriggered {
add {
AddTarget (value, UIControlEvent.PrimaryActionTriggered);

Просмотреть файл

@ -9,11 +9,16 @@
#if IOS
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Foundation;
using ObjCRuntime;
namespace UIKit {
#if !NET
[Introduced (PlatformName.iOS, 13,4, PlatformArchitecture.All)]
#else
[SupportedOSPlatform ("ios13.4")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public static partial class UIEventButtonMaskExtensions {

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using ObjCRuntime;
using Foundation;
using System.Runtime.Versioning;
namespace UIKit {
public partial class UIFont {
@ -20,70 +21,90 @@ namespace UIKit {
return String.Format ("{0} {1}", Name, PointSize);
}
#if !NET
[iOS (7,0)]
#endif
public static UIFont PreferredHeadline {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Headline);
}
}
#if !NET
[iOS (7,0)]
#endif
public static UIFont PreferredBody {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Body);
}
}
#if !NET
[iOS (7,0)]
#endif
public static UIFont PreferredSubheadline {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Subheadline);
}
}
#if !NET
[iOS (7,0)]
#endif
public static UIFont PreferredFootnote {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Footnote);
}
}
#if !NET
[iOS (7,0)]
#endif
public static UIFont PreferredCaption1 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Caption1);
}
}
#if !NET
[iOS (7,0)]
#endif
public static UIFont PreferredCaption2 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Caption2);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFont PreferredTitle1 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Title1);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFont PreferredTitle2 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Title2);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFont PreferredTitle3 {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Title3);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFont PreferredCallout {
get {
return GetPreferredFontForTextStyle (UIFontTextStyle.Callout);
@ -116,68 +137,94 @@ namespace UIKit {
}
}
#if !NET
[iOS (8,2)]
#endif
public static UIFont SystemFontOfSize (nfloat size, UIFontWeight weight)
{
return SystemFontOfSize (size, GetFontWeight (weight));
}
#if !NET
[iOS (9,0)]
#endif
public static UIFont MonospacedDigitSystemFontOfSize (nfloat size, nfloat weight)
{
var ptr = _MonospacedDigitSystemFontOfSize (size, weight);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
#if !NET
[iOS (9,0)]
#endif
public static UIFont MonospacedDigitSystemFontOfSize (nfloat fontSize, UIFontWeight weight)
{
return MonospacedDigitSystemFontOfSize (fontSize, GetFontWeight (weight));
}
#if !NET
[iOS (13,0), TV (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
public static UIFont GetMonospacedSystemFont (nfloat size, nfloat weight)
{
var ptr = _MonospacedSystemFontOfSize (size, weight);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
#if !NET
[iOS(13,0), TV(13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
#endif
public static UIFont GetMonospacedSystemFont (nfloat size, UIFontWeight weight) => GetMonospacedSystemFont (size, GetFontWeight (weight));
// In this case we want to _always_ return a different managed instance
// so one can be disposed without affecting others
// ref: https://bugzilla.xamarin.com/show_bug.cgi?id=25511
#if !NET
[iOS (7, 0)]
#endif
public static UIFont GetPreferredFontForTextStyle (NSString uiFontTextStyle)
{
var ptr = _GetPreferredFontForTextStyle (uiFontTextStyle);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
#if !NET
[iOS (7, 0)]
#endif
public static UIFont GetPreferredFontForTextStyle (UIFontTextStyle uiFontTextStyle)
{
return GetPreferredFontForTextStyle (uiFontTextStyle.GetConstant ());
}
#if !WATCH
#if !NET
[iOS (7, 0)]
#endif
public static UIFont GetPreferredFontForTextStyle (NSString uiFontTextStyle, UITraitCollection traitCollection)
{
var ptr = _GetPreferredFontForTextStyle (uiFontTextStyle, traitCollection);
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
#if !NET
[iOS (7, 0)]
#endif
public static UIFont GetPreferredFontForTextStyle (UIFontTextStyle uiFontTextStyle, UITraitCollection traitCollection)
{
return GetPreferredFontForTextStyle (uiFontTextStyle.GetConstant (), traitCollection);
}
#endif
#if !NET
[iOS (7, 0)]
#endif
public static UIFont FromDescriptor (UIFontDescriptor descriptor, nfloat pointSize)
{
var ptr = _FromDescriptor (descriptor, pointSize);
@ -196,7 +243,9 @@ namespace UIKit {
return ptr == IntPtr.Zero ? null : new UIFont (ptr);
}
#if !NET
[iOS (8,2)]
#endif
public static UIFont SystemFontOfSize (nfloat size, nfloat weight)
{
var ptr = _SystemFontOfSize (size, weight);

Просмотреть файл

@ -10,6 +10,7 @@ using System;
using ObjCRuntime;
using CoreGraphics;
using Foundation;
using System.Runtime.Versioning;
namespace UIKit {
@ -223,28 +224,36 @@ namespace UIKit {
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFontDescriptor PreferredTitle1 {
get {
return GetPreferredDescriptorForTextStyle (UIFontTextStyle.Title1);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFontDescriptor PreferredTitle2 {
get {
return GetPreferredDescriptorForTextStyle (UIFontTextStyle.Title2);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFontDescriptor PreferredTitle3 {
get {
return GetPreferredDescriptorForTextStyle (UIFontTextStyle.Title3);
}
}
#if !NET
[iOS (9,0)]
#endif
public static UIFontDescriptor PreferredCallout {
get {
return GetPreferredDescriptorForTextStyle (UIFontTextStyle.Callout);

Просмотреть файл

@ -11,6 +11,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Foundation;
using ObjCRuntime;
@ -20,11 +21,15 @@ namespace UIKit {
public static partial class UIGuidedAccessRestriction {
#if !COREBUILD
#if !NET
[iOS (7,0)]
#endif
[DllImport (Constants.UIKitLibrary)]
extern static /* UIGuidedAccessRestrictionState */ nint UIGuidedAccessRestrictionStateForIdentifier (/* NSString */ IntPtr restrictionIdentifier);
#if !NET
[iOS (7,0)]
#endif
public static UIGuidedAccessRestrictionState GetState (string restrictionIdentifier)
{
IntPtr p = NSString.CreateNative (restrictionIdentifier);
@ -34,11 +39,17 @@ namespace UIKit {
}
#if IOS
#if !NET
[iOS (12,2)]
#else
[SupportedOSPlatform ("ios12.2")]
#endif
[DllImport (Constants.UIKitLibrary)]
static extern void UIGuidedAccessConfigureAccessibilityFeatures (/* UIGuidedAccessAccessibilityFeature */ nuint features, [MarshalAs (UnmanagedType.I1)] bool enabled, IntPtr completion);
#if !NET
[iOS (12,2)]
#endif
public delegate void UIGuidedAccessConfigureAccessibilityFeaturesCompletionHandler (bool success, NSError error);
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
@ -57,7 +68,11 @@ namespace UIKit {
}
}
#if !NET
[iOS (12,2)]
#else
[SupportedOSPlatform ("ios12.2")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public static void ConfigureAccessibilityFeatures (UIGuidedAccessAccessibilityFeature features, bool enabled, UIGuidedAccessConfigureAccessibilityFeaturesCompletionHandler completionHandler)
{
@ -76,7 +91,11 @@ namespace UIKit {
}
}
#if !NET
[iOS (12,2)]
#else
[SupportedOSPlatform ("ios12.2")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public static Task<(bool Success, NSError Error)> ConfigureAccessibilityFeaturesAsync (UIGuidedAccessAccessibilityFeature features, bool enabled)
{

Просмотреть файл

@ -16,6 +16,7 @@ using CoreGraphics;
using Photos;
using System;
using System.Drawing;
using System.Runtime.Versioning;
namespace UIKit {
public partial class UIImagePickerController {
@ -100,7 +101,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (9,1)]
#endif
public PHLivePhoto LivePhoto {
get {
return (PHLivePhoto) Info [UIImagePickerController.LivePhoto];
@ -119,14 +122,22 @@ namespace UIKit {
}
}
#if !NET
[iOS (11,0)]
#else
[SupportedOSPlatform ("ios11.0")]
#endif
public PHAsset PHAsset {
get {
return (PHAsset) Info [UIImagePickerController.PHAsset];
}
}
#if !NET
[iOS (11,0)]
#else
[SupportedOSPlatform ("ios11.0")]
#endif
public NSUrl ImageUrl {
get {
return (NSUrl) Info [UIImagePickerController.ImageUrl];

Просмотреть файл

@ -7,6 +7,7 @@
using Foundation;
using ObjCRuntime;
using CoreGraphics;
using System.Runtime.Versioning;
using System;
@ -23,7 +24,11 @@ namespace UIKit {
}
#if !TVOS && !__MACCATALYST__
#if !NET
[Deprecated (PlatformName.iOS, 3, 2)]
#else
[UnsupportedOSPlatform ("ios3.2")]
#endif
public static CGRect BoundsFromNotification (NSNotification n)
{
return RectangleFFrom (BoundsUserInfoKey, n);
@ -61,13 +66,21 @@ namespace UIKit {
}
#if !TVOS && !__MACCATALYST__
#if !NET
[Deprecated (PlatformName.iOS, 3, 2)]
#else
[UnsupportedOSPlatform ("ios3.2")]
#endif
static public CGPoint CenterBeginFromNotification (NSNotification n)
{
return PointFFrom (CenterBeginUserInfoKey, n);
}
#if !NET
[Deprecated (PlatformName.iOS, 3, 2)]
#else
[UnsupportedOSPlatform ("ios3.2")]
#endif
static public CGPoint CenterEndFromNotification (NSNotification n)
{
return PointFFrom (CenterEndUserInfoKey, n);

Просмотреть файл

@ -33,6 +33,7 @@ using ObjCRuntime;
using Foundation;
using CoreFoundation;
using CoreGraphics;
using System.Runtime.Versioning;
#if !WATCH
using CoreText;
#endif
@ -156,7 +157,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public NSString WeakTextEffect {
get {
return Dictionary [UIStringAttributeKey.TextEffect] as NSString;
@ -166,7 +169,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public NSTextEffect TextEffect {
get {
var s = WeakTextEffect;
@ -186,7 +191,9 @@ namespace UIKit {
}
#if !WATCH
#if !NET
[iOS (7,0)]
#endif
public NSTextAttachment TextAttachment {
get {
return Dictionary [UIStringAttributeKey.Attachment] as NSTextAttachment;
@ -197,7 +204,9 @@ namespace UIKit {
}
#endif // !WATCH
#if !NET
[iOS (7,0)]
#endif
public NSUrl Link {
get {
return Dictionary [UIStringAttributeKey.Link] as NSUrl;
@ -207,7 +216,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public float? BaselineOffset {
get {
return GetFloatValue (UIStringAttributeKey.BaselineOffset);
@ -217,7 +228,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public UIColor StrikethroughColor {
get {
return Dictionary [UIStringAttributeKey.StrikethroughColor] as UIColor;
@ -227,7 +240,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public UIColor UnderlineColor {
get {
return Dictionary [UIStringAttributeKey.UnderlineColor] as UIColor;
@ -238,7 +253,9 @@ namespace UIKit {
}
#if !NET
[iOS (7,0)]
#endif
public float? Obliqueness {
get {
return GetFloatValue (UIStringAttributeKey.Obliqueness);
@ -248,7 +265,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public float? Expansion {
get {
return GetFloatValue (UIStringAttributeKey.Expansion);
@ -258,7 +277,9 @@ namespace UIKit {
}
}
#if !NET
[iOS (7,0)]
#endif
public NSNumber [] WritingDirectionInt {
get {
return GetArray<NSNumber> (UIStringAttributeKey.WritingDirection);

Просмотреть файл

@ -6,87 +6,147 @@ using UIKit;
using CoreGraphics;
using Foundation;
using ObjCRuntime;
using System.Runtime.Versioning;
namespace UIKit {
public unsafe static partial class UIStringDrawing {
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGPoint, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGPoint, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGPoint point, UIFont font)
{
using (var self = ((NSString) This))
return self.DrawString (point, font);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGRect, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, UILineBreakMode breakMode)
{
using (var self = ((NSString) This))
return self.DrawString (point, width, font, breakMode);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGRect, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, global::System.nfloat fontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment)
{
using (var self = ((NSString) This))
return self.DrawString (point, width, font, fontSize, breakMode, adjustment);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGRect, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, global::System.nfloat minFontSize, ref global::System.nfloat actualFontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment)
{
using (var self = ((NSString) This))
return self.DrawString (point, width, font, minFontSize, ref actualFontSize, breakMode, adjustment);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGRect, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGRect rect, UIFont font)
{
using (var self = ((NSString) This))
return self.DrawString (rect, font);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGRect, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGRect rect, UIFont font, UILineBreakMode mode)
{
using (var self = ((NSString) This))
return self.DrawString (rect, font, mode);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.DrawString(CGRect, UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize DrawString (this string This, CGRect rect, UIFont font, UILineBreakMode mode, UITextAlignment alignment)
{
using (var self = ((NSString) This))
return self.DrawString (rect, font, mode, alignment);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.GetSizeUsingAttributes(UIStringAttributes) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.GetSizeUsingAttributes(UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize StringSize (this string This, UIFont font)
{
using (var self = ((NSString) This))
return self.StringSize (font);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize StringSize (this string This, UIFont font, global::System.nfloat forWidth, UILineBreakMode breakMode)
{
using (var self = ((NSString) This))
return self.StringSize (font, forWidth, breakMode);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize StringSize (this string This, UIFont font, CGSize constrainedToSize)
{
using (var self = ((NSString) This))
return self.StringSize (font, constrainedToSize);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0, message : "Use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.")]
#else
[UnsupportedOSPlatform ("ios7.0")]
[Obsolete ("Starting with ios7.0 use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static CGSize StringSize (this string This, UIFont font, CGSize constrainedToSize, UILineBreakMode lineBreakMode)
{
using (var self = ((NSString) This))
return self.StringSize (font, constrainedToSize, lineBreakMode);
}
#if !NET
[Deprecated (PlatformName.iOS, 7, 0)]
#else
[UnsupportedOSPlatform ("ios7.0")]
#endif
public static CGSize StringSize (this string This, UIFont font, global::System.nfloat minFontSize, ref global::System.nfloat actualFontSize, global::System.nfloat forWidth, UILineBreakMode lineBreakMode)
{
using (var self = ((NSString) This))

Просмотреть файл

@ -104,7 +104,9 @@ namespace UIKit {
}
#if !WATCH
#if !NET
[iOS (9,0)]
#endif
[StructLayout (LayoutKind.Sequential)]
public struct UIFloatRange : IEquatable<UIFloatRange> {
@ -152,11 +154,13 @@ namespace UIKit {
}
#endif
#if IOS
#if IOS || __MACCATALYST__
#if !NET
[Introduced (PlatformName.iOS, 15,0)]
[Introduced (PlatformName.MacCatalyst, 15,0)]
#else
[SupportedOSPlatform ("ios15.0")]
[SupportedOSPlatform ("maccatalyst15.0")]
#endif //!NET
[StructLayout (LayoutKind.Sequential)]
public struct UIPointerAccessoryPosition {

Просмотреть файл

@ -2,6 +2,7 @@
#if IOS || TVOS
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Foundation;
#if HAS_NOTIFICATIONCENTER
using NotificationCenter;
@ -18,27 +19,52 @@ namespace UIKit {
// the resulting syntax does not look good in user code so we provide a better looking API
// https://trello.com/c/iQpXOxCd/227-category-and-static-methods-selectors
// note: we cannot reuse the same method name - as it would break compilation of existing apps
#if !NET
[Deprecated (PlatformName.iOS, 10,0, message: "Use 'CreatePrimaryVibrancyEffectForNotificationCenter' instead.")]
#else
[UnsupportedOSPlatform ("ios10.0")]
#if IOS
[Obsolete ("Starting with ios10.0 use 'CreatePrimaryVibrancyEffectForNotificationCenter' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
static public UIVibrancyEffect CreateForNotificationCenter ()
{
return (null as UIVibrancyEffect).NotificationCenterVibrancyEffect ();
}
#if !NET
[iOS (10,0)]
[Deprecated (PlatformName.iOS, 13,0, message: "Use 'UIVibrancyEffect.CreateWidgetEffectForNotificationCenter' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'UIVibrancyEffect.CreateWidgetEffectForNotificationCenter' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
static public UIVibrancyEffect CreatePrimaryVibrancyEffectForNotificationCenter ()
{
return (null as UIVibrancyEffect).GetWidgetPrimaryVibrancyEffect ();
}
#if !NET
[iOS (10,0)]
[Deprecated (PlatformName.iOS, 13,0, message: "Use 'UIVibrancyEffect.CreateWidgetEffectForNotificationCenter' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'UIVibrancyEffect.CreateWidgetEffectForNotificationCenter' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
static public UIVibrancyEffect CreateSecondaryVibrancyEffectForNotificationCenter ()
{
return (null as UIVibrancyEffect).GetWidgetSecondaryVibrancyEffect ();
}
#if !NET
[iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
#endif
static public UIVibrancyEffect CreateWidgetEffectForNotificationCenter (UIVibrancyEffectStyle vibrancyStyle)
{
return (null as UIVibrancyEffect).GetWidgetEffect (vibrancyStyle);

Просмотреть файл

@ -13,6 +13,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Versioning;
using Foundation;
#if HAS_IAD && !XAMCORE_4_0
using iAd;
@ -67,7 +68,13 @@ namespace UIKit {
// the resulting syntax does not look good in user code so we provide a better looking API
// https://trello.com/c/iQpXOxCd/227-category-and-static-methods-selectors
// note: we cannot reuse the same method name - as it would break compilation of existing apps
#if !NET
[Obsoleted (PlatformName.iOS, 15,0, PlatformArchitecture.None, Constants.iAdRemoved)]
#else
#if IOS
[Obsolete ("Starting with ios15.0 the iAd framework has been removed from iOS.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
static public void PrepareForInterstitialAds ()
{
}