コード例 #1
0
        /// <summary>
        /// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
        /// </summary>
        /*
         * public override UITableViewCell GetCell
           (UITableView tableView, NSIndexPath indexPath)
        {
           TDBadgedCell cell = new TDBadgedCell (UITableViewCellStyle.Subtitle, "Cell");
           cell.TextLabel.Text = contents[indexPath.Row].Title;
           cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (14);

           cell.DetailTextLabel.Text = contents[indexPath.Row].Detail;
           cell.DetailTextLabel.Font = UIFont.SystemFontOfSize (13);

           cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
           cell.BadgeNumber = Convert.ToInt32 (contents[indexPath.Row].Badge);

           if (indexPath.Row == 1)
          cell.BadgeColor = UIColor.FromRGBA (1.000f, 0.397f, 0.419f, 1.000f);
           if (indexPath.Row == 2)
          cell.BadgeColor = UIColor.FromWhiteAlpha (0.783f, 1.000f);
           return cell;
        }
         */
        public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            Console.WriteLine ("Calling Get Cell, isEditing:" + tableView.Editing);

            //---- declare vars
            TDBadgedCell cell = (TDBadgedCell)tableView.DequeueReusableCell (cellIdentifier);

            //---- if there are no cells to reuse, create a new one
            if (cell == null)
                cell = new TDBadgedCell (UITableViewCellStyle.Subtitle, cellIdentifier);

            //---- set the item text
            cell.TextLabel.Text = tableItems [indexPath.Section].Items [indexPath.Row].activityType.activityTypeName;
            DateTime dd = Tools.ConvertJavaMiliSecondToDateTime (tableItems [indexPath.Section].Items [indexPath.Row].lastDate);

            if (tableItems [indexPath.Section].Items [indexPath.Row].lastDate > 0) {
                cell.DetailTextLabel.Text = dd.ToLongDateString () + " - " + dd.ToShortTimeString();
                cell.DetailTextLabel.Font = UIFont.SystemFontOfSize (11);
                cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;

            }
            UIImage img = UIImage.FromFile ("Images/258-checkmark.png");
            cell.ImageView.Image = img;
            cell.BadgeNumber = Convert.ToInt32 (tableItems [indexPath.Section].Items [indexPath.Row].total);

            if (indexPath.Row == 1)
                cell.BadgeColor = UIColor.FromRGBA (1.000f, 0.397f, 0.419f, 1.000f);
            if (indexPath.Row == 2)
                cell.BadgeColor = UIColor.FromWhiteAlpha (0.783f, 1.000f);
            if (indexPath.Row == 3)
                cell.BadgeColor = UIColor.FromRGBA (1.000f, 0.333f, 0.666f, 1.000f);

            return cell;
        }
コード例 #2
0
        /// <summary>
        /// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
        /// </summary>
        public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            //---- declare vars
            TDBadgedCell cell = (TDBadgedCell)tableView.DequeueReusableCell (cellIdentifier);

            //---- if there are no cells to reuse, create a new one
            if (cell == null)
                cell = new TDBadgedCell (UITableViewCellStyle.Subtitle, cellIdentifier);

            PlatformSummaryDTO dto = tableItems [indexPath.Section].PlatFormItems [indexPath.Row];
            //---- set the item text
            cell.TextLabel.Text = dto.platform.platformName;

            cell.DetailTextLabel.Text = "Inactive Users: " + dto.numberInactive;
            cell.DetailTextLabel.Font = UIFont.SystemFontOfSize (12);

            if (dto.numberOfUsers > 0) {
                cell.Accessory = UITableViewCellAccessory.Checkmark;
            }

            UIImage img = UIImage.FromFile ("Images/32-iphone.png");
            if (dto.platform.platformName.Contains ("iPhone") || dto.platform.platformName.Contains ("iPad")) {
                img = UIImage.FromFile ("Images/apple48-blue.png");
            }
            if (dto.platform.platformName.Contains ("Android")) {
                img = UIImage.FromFile ("Images/android48-round.png");
            }
            if (dto.platform.platformName.Contains ("Blackberry")) {
                img = UIImage.FromFile ("Images/blackberry.png");
            }
            if (dto.platform.platformName.Contains ("Windows")) {
                img = UIImage.FromFile ("Images/windows.png");
            }

            cell.ImageView.Image = img;
            cell.BadgeNumber = Convert.ToInt32 (dto.numberOfUsers);

            if (indexPath.Row == 1)
                cell.BadgeColor = UIColor.FromRGBA (1.000f, 0.397f, 0.419f, 1.000f);
            if (indexPath.Row == 2)
                cell.BadgeColor = UIColor.FromWhiteAlpha (0.783f, 1.000f);
            if (indexPath.Row == 3)
                cell.BadgeColor = UIColor.FromRGBA (1.000f, 0.333f, 0.666f, 1.000f);

            return cell;
        }