本文整理汇总了C#中NSString.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# NSString.Equals方法的具体用法?C# NSString.Equals怎么用?C# NSString.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSString
的用法示例。
在下文中一共展示了NSString.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObserveValue
public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
{
base.ObserveValue(keyPath, ofObject, change, context);
if (keyPath.Equals(KeyThickness))
{
MDRadialProgressView view = (MDRadialProgressView)ofObject;
float offset = view.Theme.Thickness;
RectangleF frame = view.Frame;
float sideDimension = Math.Min(frame.Width, frame.Height) - offset;
var adjustedFrame = new RectangleF(frame.X + offset, frame.Y + offset, sideDimension, sideDimension);
Bounds = adjustedFrame;
SetNeedsLayout();
}
}
示例2: ViewDidUnload
/*
public override void ViewDidUnload ()
{
base.ViewDidUnload ();
// Clear any references to subviews of the main view in order to
// allow the Garbage Collector to collect them sooner.
//
// e.g. myOutlet.Dispose (); myOutlet = null;
ReleaseDesignerOutlets ();
}
*/
public override UIStatusBarStyle PreferredStatusBarStyle()
{
UIStatusBarStyle statusBarStyle = UIStatusBarStyle.Default;
try {
var myStatusBarStyle = NSBundle.MainBundle.ObjectForInfoDictionary("Appverse_StatusBarStyle");
NSString myStatusBarStyleNSString = new NSString("dark");
if(myStatusBarStyle!=null) {
if(myStatusBarStyle is NSString) {
myStatusBarStyleNSString = (NSString) myStatusBarStyle;
#if DEBUG
log ("Preferred StatusBar Style: " + myStatusBarStyleNSString);
#endif
}
if(myStatusBarStyleNSString!=null && myStatusBarStyleNSString.Equals(new NSString("light"))) {
#if DEBUG
log ("Preferred StatusBar Style: " + myStatusBarStyleNSString + ", applying light content status bar style");
#endif
statusBarStyle = UIStatusBarStyle.LightContent; // Content in the status bar is drawn with light values. Preferable for use wth darker-colored content views.
} else {
#if DEBUG
log ("Preferred StatusBar Style: " + myStatusBarStyleNSString + ", applying default status bar style (dark)");
#endif
}
}
} catch(Exception ex) {
#if DEBUG
log ("Exception getting 'Appverse_StatusBarStyle' from application preferences: " + ex.Message);
#endif
}
return statusBarStyle;
}
示例3: ObserveValue
public override void ObserveValue(NSString keyPath, NSObject @object, NSDictionary change, IntPtr context)
{
if (@object == this.CenterController)
{
if (keyPath.Equals(new NSString("tabBarItem.title")))
{
this.TabBarItem.Title = this.CenterController.TabBarItem.Title;
return;
}
if (keyPath.Equals(new NSString("tabBarItem.image")))
{
this.TabBarItem.Image = this.CenterController.TabBarItem.Image;
return;
}
if (keyPath.Equals(new NSString("hidesBottomBarWhenPushed")))
{
this.HidesBottomBarWhenPushed = this.CenterController.HidesBottomBarWhenPushed;
this.TabBarController.HidesBottomBarWhenPushed = this.CenterController.HidesBottomBarWhenPushed;
return;
}
}
if (keyPath.Equals(new NSString("title")))
{
if (this.Title != this.CenterController.Title)
{
this.Title = this.CenterController.Title ?? string.Empty;
}
return;
}
if (keyPath.Equals(new NSString("bounds")))
{
var offset = this.SlidingControllerView.Frame.Location.X;
this.SetSlidingFrameForOffset(offset);
this.SlidingControllerView.Layer.ShadowPath = UIBezierPath.FromRect(this.ReferenceBounds).CGPath;
UINavigationController navController = this.CenterController.GetType().IsSubclassOf(typeof(UINavigationController)) ? (UINavigationController)this.CenterController : null;
if (navController != null && !navController.NavigationBarHidden)
{
navController.NavigationBarHidden = true;
navController.NavigationBarHidden = false;
}
return;
}
}
示例4: ObserveValue
public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
{
if (ofObject == _textLabel && keyPath.Equals(@"text"))
{
NSString text = (NSString)change.ObjectForKey((NSObject)NSObject.ChangeNewKey);
Hidden = text.Length == 0;
if (!Hidden)
{
SetNeedsDisplay();
}
return;
}
base.ObserveValue(keyPath, ofObject, change, context);
}
示例5: RegisteredForRemoteNotifications
/// <summary>
/// The iOS will call the APNS in the background and issue a device token to the device. when that's
/// accomplished, this method will be called.
///
/// Note: the device token can change, so this needs to register with your server application everytime
/// this method is invoked, or at a minimum, cache the last token and check for a change.
/// </summary>
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
//The deviceToken is of interest here, this is what your push notification server needs to send out a notification
// to the device. So, most times you'd want to send the device Token to your servers when it has changed
//First, get the last device token we know of
string lastDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceToken");
//There's probably a better way to do this
NSString strFormat = new NSString ("%@");
NSString newDeviceToken = new NSString (MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr (new MonoTouch.ObjCRuntime.Class ("NSString").Handle, new MonoTouch.ObjCRuntime.Selector ("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
//We only want to send the device token to the server if it hasn't changed since last time
// no need to incur extra bandwidth by sending the device token every time
if (!newDeviceToken.Equals (lastDeviceToken)) {
//TODO: Insert your own code to send the new device token to your application server
//Save the new device token for next application launch
NSUserDefaults.StandardUserDefaults.SetString (newDeviceToken, "deviceToken");
}
}
示例6: RegisteredForRemoteNotifications
/// <summary>
/// Succcessful registration for remote notifications.
/// </summary>
/// <param name="application">Application.</param>
/// <param name="deviceToken">Device token.</param>
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
// The deviceToken is what the push notification server needs to send out a notification
// to the device. Most times application needs to send the device Token to its servers when it has changed
#if DEBUG
log ("Success registering for Remote Notifications");
#endif
// First, get the last device token we know of
string lastDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("deviceToken");
//There's probably a better way to do this
NSString strFormat = new NSString("%@");
NSString newDeviceToken = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
#if DEBUG
log ("New device token: " + newDeviceToken);
#endif
// We only want to send the device token to the server if it hasn't changed since last time
// no need to incur extra bandwidth by sending the device token every time
if (!newDeviceToken.Equals(lastDeviceToken))
{
// Send the new device token to your application server
RegitrationToken registrationToken = new RegitrationToken();
registrationToken.StringRepresentation = newDeviceToken;
byte[] buffer = new byte[deviceToken.Length];
Marshal.Copy(deviceToken.Bytes, buffer,0,buffer.Length);
registrationToken.Binary = buffer;
IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Unity.OnRegisterForRemoteNotificationsSuccess", registrationToken);
//Save the new device token for next application launch
NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "deviceToken");
}
}