本文整理汇总了C#中NSMutableArray类的典型用法代码示例。如果您正苦于以下问题:C# NSMutableArray类的具体用法?C# NSMutableArray怎么用?C# NSMutableArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSMutableArray类属于命名空间,在下文中一共展示了NSMutableArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public override Id Init()
{
this.NativePointer = this.SendMessageSuper<IntPtr>(AppControllerClass, "init");
this._data = new NSMutableArray().Retain<NSMutableArray>();
return this;
}
示例2: 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;
}
示例3: GetMountedVolumes
public NSMutableArray GetMountedVolumes()
{
NSMutableArray volumeList = new NSMutableArray();
NSArray volKeys = NSArray.FromNSObjects(
NSUrl.VolumeLocalizedNameKey,
NSUrl.VolumeTotalCapacityKey,
NSUrl.VolumeAvailableCapacityKey,
NSUrl.VolumeIsBrowsableKey,
NSUrl.VolumeURLKey,
NSUrl.VolumeUUIDStringKey
);
NSFileManager fileManager = new NSFileManager();
NSUrl[] volumeUrls = fileManager.GetMountedVolumes(volKeys, NSVolumeEnumerationOptions.None);
NSByteCountFormatter byteFormatter = new NSByteCountFormatter();
byteFormatter.CountStyle = NSByteCountFormatterCountStyle.File;
foreach(NSUrl volumeUrl in volumeUrls) {
NSError volUrlError;
NSObject volName;
NSObject volIdentifer;
NSObject volBrowsable;
NSObject volBytesAvailable;
NSObject volBytesTotal;
volumeUrl.TryGetResource(NSUrl.VolumeLocalizedNameKey, out volName, out volUrlError);
volumeUrl.TryGetResource(NSUrl.VolumeURLKey, out volIdentifer, out volUrlError);
volumeUrl.TryGetResource(NSUrl.VolumeIsBrowsableKey, out volBrowsable, out volUrlError);
volumeUrl.TryGetResource(NSUrl.VolumeAvailableCapacityKey, out volBytesAvailable, out volUrlError);
volumeUrl.TryGetResource(NSUrl.VolumeTotalCapacityKey, out volBytesTotal, out volUrlError);
NSNumber volBytesAvailableNum = (NSNumber)volBytesAvailable;
NSNumber volBytesTotalNum = (NSNumber)volBytesTotal;
byteFormatter.IncludesUnit = false;
byteFormatter.IncludesCount = true;
var volBytesAvailableCount = byteFormatter.Format(volBytesAvailableNum.LongValue);
var volBytesTotalCount = byteFormatter.Format(volBytesTotalNum.LongValue);
byteFormatter.IncludesUnit = true;
byteFormatter.IncludesCount = false;
var volBytesAvailableUnit = byteFormatter.Format(volBytesAvailableNum.LongValue);
var volBytesTotalUnit = byteFormatter.Format(volBytesTotalNum.LongValue);
NSNumber browsable = (NSNumber)volBrowsable;
if (browsable.BoolValue) {
volumeList.Add(new NSDictionary(
"name", volName,
"id", volIdentifer,
"bytesAvailableCount", volBytesAvailableCount,
"bytesAvailableUnit", volBytesAvailableUnit,
"bytesTotalCount", volBytesTotalCount,
"bytesTotalUnit", volBytesTotalUnit
));
}
}
return volumeList;
}
示例4: ReadRectanglesXml
private NSMutableArray ReadRectanglesXml(PinboardData.RectangleInfo screenRectangle)
{
var list = new NSMutableArray();
// Read <Rectangles>
reader.ReadStartElement(rectanglesAtom);
reader.MoveToContent();
while (true)
{
if (String.ReferenceEquals(reader.Name, rectanglesAtom))
{
reader.ReadEndElement();
reader.MoveToContent();
break;
}
var rectInfo = ReadRectangleXml();
// Flip the rectangle top to bottom relative to the screen rectangle
rectInfo.Y = screenRectangle.Height - rectInfo.Y - rectInfo.Height;
list.Add(rectInfo);
}
return list;
}
示例5: 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;
}
示例6: ViewDidLoad
public override void ViewDidLoad()
{
AddOption ("TKChart", useChart);
AddOption ("TKCalendar", useCalendar);
AddOption ("UITableView", useTableView);
AddOption ("UICollectionView", useCollectionView);
AddOption ("TKListView", useListView);
base.ViewDidLoad ();
string[] imageNames = new string[] {"CENTCM.jpg", "FAMIAF.jpg", "CHOPSF.jpg", "DUMONF.jpg", "ERNSHM.jpg", "FOLIGF.jpg"};
string[] names = new string[] { "John", "Abby", "Phill", "Saly", "Robert", "Donna" };
NSMutableArray array = new NSMutableArray ();
Random r = new Random ();
for (int i = 0; i < imageNames.Length; i++) {
UIImage image = new UIImage (imageNames [i]);
this.AddItem (array, names [i], r.Next (100), r.Next (100) > 50 ? "two" : "one", r.Next (10), image);
}
this.dataSource.DisplayKey = "Name";
this.dataSource.ValueKey = "Value";
this.dataSource.ItemSource = array;
this.useChart (this, EventArgs.Empty);
}
示例7: AccessGrantedForContactStore
void AccessGrantedForContactStore ()
{
string plistPath = NSBundle.MainBundle.PathForResource ("Menu", "plist");
menuArray = NSMutableArray.FromFile (plistPath);
TableView.ReloadData ();
}
示例8: 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);
}
示例9: LeftButtons
private UIButton[] LeftButtons()
{
var leftUtilityButtons = new NSMutableArray();
leftUtilityButtons.AddUtilityButton(UIColor.FromRGB(242, 38, 19), UIImage.FromBundle("delete_big.png"));
leftUtilityButtons.AddUtilityButton(UIColor.FromRGB(30, 130, 76), UIImage.FromBundle("share_big.png"));
return NSArray.FromArray<UIButton>(leftUtilityButtons);
}
示例10: 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();
}
示例11: 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 ();
}
示例12: 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);
}
}
}
}
示例13: 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);
}
}
示例14: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
FoodItems = new NSMutableArray ();
if(HealthStore != null)
UpdateJournal (null, null);
UIApplication.Notifications.ObserveDidBecomeActive (UpdateJournal);
}
示例15: ChartSemiPieDataSource
public ChartSemiPieDataSource ()
{
DataPoints = new NSMutableArray ();
AddDataPointsForChart("Product A", 14);
AddDataPointsForChart("Product B", 54);
AddDataPointsForChart("Product C", 23);
AddDataPointsForChart("Product D", 53);
}