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


C# NSMutableArray.AddObject方法代码示例

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


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

示例1: ToolbarDefaultItemIdentifiers

 public NSArray ToolbarDefaultItemIdentifiers(NSToolbar toolbar)
 {
     NSMutableArray array = new NSMutableArray();
     array.AddObject((NSString) "FontStyle");
     array.AddObject((NSString) "FontSize");
     array.AddObject(NSToolbarItem.NSToolbarSeparatorItemIdentifier);
     array.AddObject((NSString) "BlueLetter");
     array.AddObject(NSToolbarItem.NSToolbarPrintItemIdentifier);
     return array;
 }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:10,代码来源:Controller.cs

示例2: CreateAudioDisc

partial         void CreateAudioDisc(Id sender)
        {
            NSArray files = this.SelectAudioFiles();
            if (files != null)
            {
                NSMutableArray trackList = new NSMutableArray(files.Count);
                foreach (NSString filepath in files.GetEnumerator<NSString>())
                {
                    trackList.AddObject(DRTrack.TrackForAudioFile(filepath));
                }
                this.BurnLayoutWithDescription(trackList, "Burning audio disc");
            }
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:13,代码来源:AppController.cs

示例3: AwakeFromNib

        public virtual void AwakeFromNib()
        {
            // If you make sure your dates are calculated at noon, you shouldn't have to
            // worry about daylight savings. If you use midnight, you will have to adjust
            // for daylight savings time.
            NSDate refDate = NSDate.DateWithNaturalLanguageString ("12:00 Oct 27, 2010");
            double oneDay = 24 * 60 * 60;

            // Create graph from theme
            graph = new CPTXYGraph (CGRect.CGRectZero);
            CPTTheme theme = CPTTheme.ThemeNamed (CPTTheme.kCPTDarkGradientTheme);
            graph.ApplyTheme (theme);
            hostView.HostedGraph = graph;

            // Title
            CPTMutableTextStyle textStyle = CPTMutableTextStyle.TextStyle;
            textStyle.Color = CPTColor.WhiteColor;
            textStyle.FontSize = 18.0;
            textStyle.FontName = "Helvetica";
            graph.Title = "Click to Toggle Range Plot Style";
            graph.TitleTextStyle = textStyle;
            graph.TitleDisplacement = new CGPoint (0.0f, -20.0f);

            // Setup scatter plot space
            CPTXYPlotSpace plotSpace = graph.DefaultPlotSpace.CastTo<CPTXYPlotSpace> ();
            double xLow = oneDay * 0.5;
            plotSpace.XRange = CPTPlotRange.PlotRangeWithLocationLength (NSDecimal.FromDouble (xLow), NSDecimal.FromDouble (oneDay * 5.0));
            plotSpace.YRange = CPTPlotRange.PlotRangeWithLocationLength (NSDecimal.FromDouble (1.0), NSDecimal.FromDouble (3.0));

            // Axes
            CPTXYAxisSet axisSet = graph.AxisSet.CastTo<CPTXYAxisSet> ();
            CPTXYAxis x = axisSet.XAxis;
            x.MajorIntervalLength = NSDecimal.FromDouble (oneDay);
            x.OrthogonalCoordinateDecimal = NSDecimal.FromString ("2");
            x.MinorTicksPerInterval = 0;
            NSDateFormatter dateFormatter = new NSDateFormatter ().Autorelease<NSDateFormatter> ();
            dateFormatter.DateStyle = NSDateFormatterStyle.NSDateFormatterShortStyle;
            CPTTimeFormatter timeFormatter = new CPTTimeFormatter (dateFormatter).Autorelease<CPTTimeFormatter> ();
            timeFormatter.ReferenceDate = refDate;
            x.LabelFormatter = timeFormatter;

            CPTXYAxis y = axisSet.YAxis;
            y.MajorIntervalLength = NSDecimal.FromString (@"0.5");
            y.MinorTicksPerInterval = 5;
            y.OrthogonalCoordinateDecimal = NSDecimal.FromDouble (oneDay);

            // Create a plot that uses the data source method
            CPTRangePlot dataSourceLinePlot = new CPTRangePlot ().Autorelease<CPTRangePlot> ();
            dataSourceLinePlot.Identifier = PLOT_IDENTIFIER;

            // Add line style
            CPTMutableLineStyle lineStyle = CPTMutableLineStyle.LineStyle;
            lineStyle.LineWidth = 1.0;
            lineStyle.LineColor = CPTColor.GreenColor;
            barLineStyle = lineStyle.Retain<CPTLineStyle> ();
            dataSourceLinePlot.BarLineStyle = barLineStyle;

            // Bar properties
            dataSourceLinePlot.BarWidth = 10.0;
            dataSourceLinePlot.GapWidth = 20.0;
            dataSourceLinePlot.GapHeight = 20.0;
            dataSourceLinePlot.DataSource = this;

            // Add plot
            graph.AddPlot (dataSourceLinePlot);
            graph.DefaultPlotSpace.Delegate = this;

            // Store area fill for use later
            CPTColor transparentGreen = CPTColor.GreenColor.ColorWithAlphaComponent (0.2);
            areaFill = new CPTFill (transparentGreen);

            // Add some data
            NSMutableArray newData = new NSMutableArray();
            NSUInteger i;
            Random rand = new Random ();
            for (i = 0; i < 5; i++) {
                double xx = oneDay * (i + 1.0);
                double yy = 3.0 * rand.Next () / (double)Int32.MaxValue + 1.2;
                double rHigh = rand.Next () / (double)Int32.MaxValue * 0.5 + 0.25;
                double rLow = rand.Next () / (double)Int32.MaxValue * 0.5 + 0.25;
                double rLeft = (rand.Next () / (double)Int32.MaxValue * 0.125 + 0.125) * oneDay;
                double rRight = (rand.Next () / (double)Int32.MaxValue * 0.125 + 0.125) * oneDay;

                newData.AddObject (NSDictionary.DictionaryWithObjectsAndKeys (
                                                                              NSDecimalNumber.NumberWithDouble (xx), CPTRangePlot.FieldX,
                                                                              NSDecimalNumber.NumberWithDouble (yy), CPTRangePlot.FieldY,
                                                                              NSDecimalNumber.NumberWithDouble (rHigh), CPTRangePlot.FieldHigh,
                                                                              NSDecimalNumber.NumberWithDouble (rLow), CPTRangePlot.FieldLow,
                                                                              NSDecimalNumber.NumberWithDouble (rLeft), CPTRangePlot.FieldLeft,
                                                                              NSDecimalNumber.NumberWithDouble (rRight), CPTRangePlot.FieldRight,
                                                                              null));
            }

            plotData = newData;
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:95,代码来源:Controller.cs

示例4: ControlTextViewCompletionsForPartialWordRangeIndexOfSelectedItem

        public NSArray ControlTextViewCompletionsForPartialWordRangeIndexOfSelectedItem(NSControl control, NSTextView textView, NSArray words, NSRange charRange, ref int index)
        {
            NSMutableArray matches;
            NSString partialString;
            NSArray keywords;
            int i;
            uint count;
            NSString str;

            partialString = textView.String.SubstringWithRange(charRange);
            keywords = this.AllKeywords();
            count = keywords.Count;
            matches = new NSMutableArray();

            // find any match in our keyword array against what was typed
            for (i = 0; i < count; i++)
            {
                str = keywords[i].CastTo<NSString>();
                if (str.RangeOfStringOptionsRange(partialString, NSStringCompareOptions.NSAnchoredSearch | NSStringCompareOptions.NSCaseInsensitiveSearch, NSRange.NSMakeRange(0, str.Length)).location != NSUInteger.NSNotFound)
                {
                    matches.AddObject(str);
                }
            }
            matches.SortUsingSelector(ObjectiveCRuntime.Selector("compare:"));

            return matches;
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:27,代码来源:MyWindowController.cs


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