当前位置: 首页>>代码示例>>C#>>正文


C# NSObject.GetType方法代码示例

本文整理汇总了C#中NSObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# NSObject.GetType方法的具体用法?C# NSObject.GetType怎么用?C# NSObject.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NSObject的用法示例。


在下文中一共展示了NSObject.GetType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsEqual

		public override bool IsEqual (NSObject obj)
		{
			if (obj.GetType () != typeof(MyCollectionViewGridLayoutAttributes))
				return false;

			var other = (MyCollectionViewGridLayoutAttributes)obj;
			if (!base.IsEqual (other))
				return false;

			if (!BackgroundColor.Equals (other.BackgroundColor))
				return false;

			return true;
		}
开发者ID:rzaitov,项目名称:selfContained,代码行数:14,代码来源:ViewController.cs

示例2: CheckHandle

 protected override void CheckHandle(NSObject obj)
 {
     bool result = obj.Handle != IntPtr.Zero;
     if (!result) {
         string name = obj.GetType ().Name;
         switch (name) {
         // FIXME: it's not clear what's the alternative to 'init' and it could be because I have no phone device
         case "CTCallCenter":
         case "CTTelephonyNetworkInfo":
             return;
         // to avoid crashes we do not really create (natively) default instances (iOS gives them to us)
         // for compatibility purpose - we should never had included the default .ctor in monotouch.dll
         case "CAMediaTimingFunction":
         case "CLHeading":
         case "CLRegion":
         case "CLPlacemark":
         case "CMAccelerometerData":
         case "CMLogItem":
         case "CMAttitude":
         case "CMDeviceMotion":
         case "CMGyroData":
         case "CMMagnetometerData":
             return;
         // under iOS5 only - MPMediaPickerController: Unable to access iPod library.
         case "MPMediaPickerController":
             return;
         // re-enabled as an [Obsolete ("", true)] but it will crash if we create it (which we can since we use reflection)
         case "NSTimer":
         case "NSCompoundPredicate":
             return;
         // iOS9 - the instance was "kind of valid" before
         case "PKPaymentAuthorizationViewController":
             if (CheckiOSSystemVersion (9,0))
                 return;
             break;
         }
         base.CheckHandle (obj);
     }
 }
开发者ID:yudhitech,项目名称:xamarin-macios,代码行数:39,代码来源:iOSApiCtorInitTest.cs

示例3: Scrub

		partial void Scrub (NSObject sender)
		{
			if(sender.GetType() == typeof(UISlider) && !IsSeeking)
			{
				IsSeeking = true;
				UISlider slider = (UISlider)sender;

				CMTime playerDuration = _playerItem.Duration;
				if(playerDuration == CMTime.Invalid){
					return;
				}

				double duration = playerDuration.Seconds;
				if(!double.IsInfinity(duration) && !double.IsNaN(duration))
				{
					float minValue = slider.MinValue;
					float maxValue = slider.MaxValue;
					float value = slider.Value;

					double time = duration * (value - minValue) / (maxValue - minValue);

					_player.Seek(CMTime.FromSeconds(time, NSEC_PER_SEC), async delegate(bool finished) {
						IsSeeking = false;	
					});

					/*TODO  We can update time labels here */
				}
			}
		}
开发者ID:nunohorta,项目名称:recipes,代码行数:29,代码来源:AVPlayerDemoViewController.cs

示例4: CheckToString

 protected override void CheckToString(NSObject obj)
 {
     string name = obj.GetType ().Name;
     switch (name) {
     // crash at at MonoTouch.Foundation.NSObject.get_Description () [0x0000b] in /mono/ios/monotouch-ios7/monotouch/src/Foundation/NSObject.g.cs:500
     case "SKTexture":
     case "MCSession":
     // crash at at MonoTouch.Foundation.NSObject.get_Description () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.g.cs:554
     case "AVPlayerItemTrack":
     case "AVCaptureConnection":
         return;
     // worked before ios6.0 beta 1
     case "AVComposition":
     // new API in iOS7
     case "AVAssetResourceLoadingDataRequest":
     // Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil
     case "NSLayoutConstraint":
     // new in 6.0
     case "AVAssetResourceLoadingRequest":
     case "GKScoreChallenge": // Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[GKScoreChallenge challengeID]: unrecognized selector sent to instance 0x18acc340
     case "GKAchievementChallenge": // Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[GKAchievementChallenge challengeID]: unrecognized selector sent to instance 0x160f4840
         if (CheckiOSOrTVOSSystemVersion (6,0))
             return;
         break;
     // crash (when asking `description`) under iOS5 (only) simulator
     case "NSUrlConnection":
         return;
     // iOS 9 beta 1 - crash when called
     case "WKFrameInfo":
     case "WKNavigation":
     case "WKNavigationAction":
         if (CheckiOSSystemVersion (9,0))
             return;
         break;
     default:
         base.CheckToString (obj);
         break;
     }
 }
开发者ID:yudhitech,项目名称:xamarin-macios,代码行数:39,代码来源:iOSApiCtorInitTest.cs

示例5: CheckNSObjectProtocol

 protected override void CheckNSObjectProtocol(NSObject obj)
 {
     switch (obj.GetType ().Name) {
     case "NSString":
         // according to bots `isKindOf (null)` returns true before iOS 8, ref: #36726
         if (!CheckiOSOrTVOSSystemVersion (8, 0))
             return;
         break;
     }
     base.CheckNSObjectProtocol (obj);
 }
开发者ID:yudhitech,项目名称:xamarin-macios,代码行数:11,代码来源:iOSApiCtorInitTest.cs

示例6: Write

			static void Write (string desc, NSObject value)
			{
				Console.Write ("# Extra Tests: {0}={1}", desc, value);
				Console.Write ("; Null? {0}; Type={1}", value == null, value == null ? "<none>" : value.GetType().Name);
				Console.WriteLine ();
			}
开发者ID:jonpryor,项目名称:monotouch-samples,代码行数:6,代码来源:CoreTextDemo.cs

示例7: StringFor

        // Gets the string for the text field from the object passed in.
        public override string StringFor(NSObject value)
        {
            // Not a color?
            if (value.GetType() != typeof(NSColor)) {
                return null;
            }

            // Convert to an RGB color space
            NSColor color = ((NSColor)value).UsingColorSpace(NSColorSpace.CalibratedRGB);

            // Get components as floats between 0 and 1
            nfloat red, green, blue, alpha;
            color.GetRgba(out red, out green, out blue, out alpha);

            // Initialize the distance to something large
            double minDistance = 3.0f;
            string closestKey = "";

            // Find the closest color
            foreach (string key in colorList.AllKeys()) {
                NSColor c = colorList.ColorWithKey(key);
                nfloat r, g, b, a;
                c.GetRgba(out r, out g, out b, out a);

                // How far apart are color and c?
                double distance = (Math.Pow(red - r, 2) + Math.Pow(green - g, 2) + Math.Pow(blue - b, 2));
                // Is this the closest yet?
                if (distance < minDistance) {
                    minDistance = distance;
                    closestKey = key;
                }

            }
            return closestKey;
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:36,代码来源:ColorFormatter.cs

示例8: PrepareForSegue

 public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
 {
     //photoDetailController controller = segue.DestinationViewController as photoDetailController;
     Console.WriteLine ("Preparing for segue: " + segue.ToString ());
     Console.WriteLine ("From object: " + sender.GetType ().ToString ());
 }
开发者ID:MobiusGen,项目名称:Animal-Care-iOS,代码行数:6,代码来源:GalleryController.cs


注:本文中的NSObject.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。