本文整理汇总了C#中NSMutableArray.Add方法的典型用法代码示例。如果您正苦于以下问题:C# NSMutableArray.Add方法的具体用法?C# NSMutableArray.Add怎么用?C# NSMutableArray.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSMutableArray
的用法示例。
在下文中一共展示了NSMutableArray.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GettingStarted
public GettingStarted ()
{
view = new UIView ();
label = new UILabel ();
label.Text = "Getting Started";
label.Frame=new CGRect(0,0,300,30);
//view.AddSubview (label);
tree = new SFTreeMap ();
tree.LeafItemSettings = new SFLeafItemSetting ();
tree.LeafItemSettings.LabelStyle = new SFStyle () { Font = UIFont.SystemFontOfSize (12), Color = UIColor.White };
tree.LeafItemSettings.LabelPath = (NSString)"Label";
tree.LeafItemSettings.ShowLabels = true;
tree.LeafItemSettings.Gap = 2;
tree.LeafItemSettings.BorderColor=UIColor.Gray;
tree.LeafItemSettings.BorderWidth = 1;
NSMutableArray ranges = new NSMutableArray ();
ranges.Add (new SFRange () {
LegendLabel = (NSString)"1 % Growth",
From = 0,
To = 1,
Color = UIColor.FromRGB (0x77, 0xD8, 0xD8)
});
ranges.Add (new SFRange () {
LegendLabel = (NSString)"2 % Growth",
From = 0,
To = 2,
Color = UIColor.FromRGB (0xAE, 0xD9, 0x60)
});
ranges.Add (new SFRange () {
LegendLabel = (NSString)"3 % Growth",
From = 0,
To = 3,
Color = UIColor.FromRGB (0xFF, 0xAF, 0x51)
});
ranges.Add (new SFRange () {
LegendLabel = (NSString)"4 % Growth",
From = 0,
To = 4,
Color = UIColor.FromRGB (0xF3, 0xD2, 0x40)
});
tree.LeafItemColorMapping = new SFRangeColorMapping () { Ranges = ranges };
CGSize legendSize = new CGSize (this.Frame.Size.Width, 60);
CGSize iconSize = new CGSize (17, 17);
UIColor legendColor = UIColor.Gray;
tree.LegendSettings = new SFLegendSetting () {
LabelStyle = new SFStyle () {
Font = UIFont.SystemFontOfSize (12),
Color = legendColor
},
IconSize = iconSize,
ShowLegend = true,
Size = legendSize
};
GetPopulationData ();
tree.Items = PopulationDetails;
AddSubview (view);
control = this;
}
示例2: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.listViewDelegate = new NotificationsListViewDelegate(this);
NSMutableArray types = new NSMutableArray ();
types.Add (new NSString ("Error"));
types.Add (new NSString ("Warning"));
types.Add (new NSString ("Success"));
types.Add (new NSString("Info"));
dataSource = new TKDataSource(types);
listView = new TKListView ();
listView.Frame = this.View.Bounds;
listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
listView.Delegate = listViewDelegate;
listView.WeakDataSource = dataSource;
this.View.AddSubview (listView);
titles = new NSMutableArray ();
titles.Add (new NSString ("Oh no!"));
titles.Add (new NSString ("Warning!"));
titles.Add (new NSString ("Well done!"));
titles.Add (new NSString ("Info."));
messages = new NSMutableArray ();
messages.Add (new NSString ("Change this and try again!"));
messages.Add (new NSString ("e careful next time"));
messages.Add (new NSString ("You successfully read this message"));
messages.Add (new NSString ("This is TKAlert dialog"));
colors = new NSMutableArray ();
colors.Add(new UIColor(1f, 0f, 0.282f, 1f));
colors.Add(new UIColor(1f, 0.733f, 0f, 1f));
colors.Add(new UIColor(0.478f, 0.988f, 0.157f, 1f));
colors.Add(new UIColor(0.231f, 0.678f, 1f, 1f));
alert = new TKAlert ();
alert.Style.ContentSeparatorWidth = 0;
alert.Style.TitleColor = new UIColor (1f, 1f, 1f, 1f);
alert.Style.MessageColor = new UIColor (1f, 1f, 1f, 1f);
alert.Style.CornerRadius = 0;
alert.Style.ShowAnimation = TKAlertAnimation.SlideFromTop;
alert.Style.DismissAnimation = TKAlertAnimation.SlideFromTop;
alert.Style.BackgroundStyle = TKAlertBackgroundStyle.None;
alert.DismissMode = TKAlertDismissMode.Tap;
}
示例3: AAPLRatingControl
public AAPLRatingControl()
{
Rating = AAPLRatingControlMinimumRating;
var blurredEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light);
backgroundView = new UIVisualEffectView(blurredEffect);
backgroundView.ContentView.BackgroundColor = UIColor.FromWhiteAlpha(0.7f, 0.2f);
Add(backgroundView);
var append = "";
var imageViews = new NSMutableArray();
for (int rating = AAPLRatingControlMinimumRating; rating <= AAPLRatingControlMaximumRating; rating++)
{
var imageView = new UIImageView
{
UserInteractionEnabled = true,
Image = UIImage.FromBundle("ratingInactive" + append),
HighlightedImage = UIImage.FromBundle("ratingActive" + append).ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal),
AccessibilityLabel = string.Format("{0} bananas", rating + 1)
};
imageView.HighlightedImage = imageView.HighlightedImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
Add(imageView);
imageViews.Add(imageView);
}
ImageViews = imageViews;
UpdateImageViews();
SetupConstraints();
}
示例4: RatingControl
public RatingControl ()
{
Rating = AAPLRatingControlMinimumRating;
var blurredEffect = UIBlurEffect.FromStyle (UIBlurEffectStyle.Light);
backgroundView = new UIVisualEffectView (blurredEffect);
backgroundView.ContentView.BackgroundColor = UIColor.FromWhiteAlpha (0.7f, 0.3f);
Add (backgroundView);
var imageViews = new NSMutableArray ();
for (nint rating = AAPLRatingControlMinimumRating; rating <= AAPLRatingControlMaximumRating; rating++) {
UIImageView imageView = new UIImageView ();
imageView.UserInteractionEnabled = true;
imageView.Image = UIImage.FromBundle ("ratingInactive");
imageView.HighlightedImage = UIImage.FromBundle ("ratingActive");
imageView.HighlightedImage = imageView.HighlightedImage.ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate);
imageView.AccessibilityLabel = string.Format ("{0} stars", rating + 1);
Add (imageView);
imageViews.Add (imageView);
}
ImageViews = imageViews;
UpdateImageViews ();
SetupConstraints ();
}
示例5: SetupSlide
public override void SetupSlide (PresentationViewController presentationViewController)
{
// Create a node to own the "sign" model, make it to be close to the camera, rotate by 90 degree because it's oriented with z as the up axis
var intermediateNode = SCNNode.Create ();
intermediateNode.Position = new SCNVector3 (0, 0, 7);
intermediateNode.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI / 2));
GroundNode.AddChildNode (intermediateNode);
// Load the "sign" model
var signNode = Utils.SCAddChildNode (intermediateNode, "sign", "Scenes/intersection/intersection", 30);
signNode.Position = new SCNVector3 (4, -2, 0.05f);
// Re-parent every node that holds a camera otherwise they would inherit the scale from the "sign" model.
// This is not a problem except that the scale affects the zRange of cameras and so it would be harder to get the transition from one camera to another right
var cameraNodes = new NSMutableArray ();
foreach (SCNNode child in signNode) {
if (child.Camera != null)
cameraNodes.Add (child);
}
for (nuint i = 0; i < cameraNodes.Count; i++) {
var cameraNode = new SCNNode (cameraNodes.ValueAt ((uint)i));
var previousWorldTransform = cameraNode.WorldTransform;
intermediateNode.AddChildNode (cameraNode); // re-parent
cameraNode.Transform = intermediateNode.ConvertTransformFromNode (previousWorldTransform, null);
cameraNode.Scale = new SCNVector3 (1, 1, 1);
}
}
示例6: SaveToDictionary
public static void SaveToDictionary(this IStateBundle state, NSMutableDictionary bundle)
{
var formatter = new BinaryFormatter();
foreach (var kv in state.Data.Where(x => x.Value != null))
{
var value = kv.Value;
if (value.GetType().IsSerializable)
{
using (var stream = new MemoryStream())
{
formatter.Serialize(stream, value);
stream.Position = 0;
var bytes = stream.ToArray();
var array = new NSMutableArray();
foreach (var b in bytes)
{
array.Add(NSNumber.FromByte(b));
}
bundle.Add(new NSString(kv.Key), array);
}
}
}
}
示例7: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
var r = new Random ();
var generator = new LoremIpsumGenerator ();
items = new NSMutableArray ();
for (int i = 0; i < 20; i++) {
items.Add (new NSString(generator.GenerateString (2 + r.Next (30))));
}
dataSource = new TKDataSource (items);
dataSource.Settings.ListView.DefaultCellClass = new ObjCRuntime.Class (typeof(ListViewVariableSizeCell));
dataSource.Settings.ListView.InitCell ((TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) => {
var myCell = cell as ListViewVariableSizeCell;
myCell.label.Text = item.Description;
});
var list = new TKListView (this.View.Bounds);
list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
list.WeakDataSource = dataSource;
this.View.AddSubview (list);
var layout = list.Layout as TKListViewLinearLayout;
layout.DynamicItemSize = true;
}
示例8: saveNotes
public void saveNotes(Collection<string> notes)
{
NSMutableArray arrayNotes = new NSMutableArray ();
for (int i = 0; i < notes.Count; i++) {
arrayNotes.Add (new NSString (notes [i]));
}
NSUserDefaults.StandardUserDefaults.SetValueForKey (arrayNotes, new NSString (NOTES));
NSUserDefaults.StandardUserDefaults.Synchronize ();
}
示例9: Initialize
// Shared initialization code
void Initialize ()
{
repeatCount = 1;
categoryArray = new NSMutableArray ();
categories = TestSuite.Categories;
foreach (var category in categories) {
categoryArray.Add ((NSString)category.Name);
}
}
示例10: Copy
public void Copy(string data)
{
NSPasteboard glob = NSPasteboard.GeneralPasteboard;
NSMutableArray types = new NSMutableArray();
types.Add(NSPasteboard.NSStringPboardType);
glob.DeclareTypesOwner(types, null);
glob.SetStringForType(data, NSPasteboard.NSStringPboardType);
}
示例11: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
dataSource = new TKDataSource ();
dataSource.AddFilterDescriptor (new TKDataSourceFilterDescriptor ("NOT (Name like 'John')"));
dataSource.AddSortDescriptor (new TKDataSourceSortDescriptor ("Name", true));
dataSource.AddGroupDescriptor (new TKDataSourceGroupDescriptor ("Group"));
var array = new NSMutableArray ();
array.Add (new DSItem () { Name = "John", Value = 22.0f, Group = "one" });
array.Add (new DSItem () { Name = "Peter", Value = 15.0f, Group = "one" });
array.Add (new DSItem () { Name = "Abby", Value = 47.0f, Group = "one" });
array.Add (new DSItem () { Name = "Robert", Value = 45.0f, Group = "two" });
array.Add (new DSItem () { Name = "Alan", Value = 17.0f, Group = "two" });
array.Add (new DSItem () { Name = "Saly", Value = 33.0f, Group = "two" });
dataSource.DisplayKey = "Name";
dataSource.ValueKey = "Value";
dataSource.ItemSource = array;
var tableView = new UITableView (this.View.Bounds);
tableView.DataSource = dataSource;
this.View.AddSubview (tableView);
}
示例12: GetAsData
//
// Save support:
// Override one of GetAsData, GetAsFileWrapper, or WriteToUrl.
//
// This method should store the contents of the document using the given typeName
// on the return NSData value.
public override NSData GetAsData(string documentType, out NSError outError)
{
outError = null;
NSMutableArray array = new NSMutableArray();
foreach (Oval o in Ovals) {
array.Add(o);
}
// Create an NSData object from the employees array
NSData data = NSKeyedArchiver.ArchivedDataWithRootObject(array);
return data;
}
示例13: ChartSplineAreaDataSource
public ChartSplineAreaDataSource ()
{
DataPoints1 = new NSMutableArray ();
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2002"), NSObject.FromObject(2.2)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2003"), NSObject.FromObject(3.4)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2004"), NSObject.FromObject(2.8)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2005"), NSObject.FromObject(1.6)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2006"), NSObject.FromObject(2.3)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2007"), NSObject.FromObject(2.5)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2008"), NSObject.FromObject(2.9)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2009"), NSObject.FromObject(3.8)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2010"), NSObject.FromObject(1.4)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2011"), NSObject.FromObject(3.1)));
DataPoints2 = new NSMutableArray ();
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2002"), NSObject.FromObject(2.0)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2003"), NSObject.FromObject(1.7)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2004"), NSObject.FromObject(1.8)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2005"), NSObject.FromObject(2.1)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2006"), NSObject.FromObject(2.3)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2007"), NSObject.FromObject(1.7)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2008"), NSObject.FromObject(1.5)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2009"), NSObject.FromObject(2.8)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2010"), NSObject.FromObject(1.5)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2011"), NSObject.FromObject(2.3)));
DataPoints3 = new NSMutableArray ();
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2002"), NSObject.FromObject(0.8)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2003"), NSObject.FromObject(1.3)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2004"), NSObject.FromObject(1.1)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2005"), NSObject.FromObject(1.6)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2006"), NSObject.FromObject(2.0)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2007"), NSObject.FromObject(1.7)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2008"), NSObject.FromObject(2.3)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2009"), NSObject.FromObject(2.7)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2010"), NSObject.FromObject(1.1)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2011"), NSObject.FromObject(2.3)));
}
示例14: ChartTrackballDataSource
public ChartTrackballDataSource ()
{
DataPoints1 = new NSMutableArray ();
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (1), NSObject.FromObject(54)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (2), NSObject.FromObject(24)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (3), NSObject.FromObject(53)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (4), NSObject.FromObject(63)));
DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (5), NSObject.FromObject(35)));
DataPoints2 = new NSMutableArray ();
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (1), NSObject.FromObject(34)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (2), NSObject.FromObject(20)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (3), NSObject.FromObject(43)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (4), NSObject.FromObject(53)));
DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (5), NSObject.FromObject(25)));
DataPoints3 = new NSMutableArray ();
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (1), NSObject.FromObject(24)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (2), NSObject.FromObject(14)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (3), NSObject.FromObject(33)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (4), NSObject.FromObject(43)));
DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (5), NSObject.FromObject(15)));
}
示例15: AddItem
void AddItem(NSMutableArray array, string name, float value, string group, int day, UIImage image)
{
NSCalendar calendar = NSCalendar.CurrentCalendar;
NSDateComponents components = new NSDateComponents ();
components.Day = day;
NSDate date = calendar.DateByAddingComponents (components, NSDate.Now, NSCalendarOptions.None);
DSItem item = new DSItem () {
Name = name,
Value = value,
Group = group,
Date = date,
Image = image
};
array.Add (item);
}