コード例 #1
0
        // Generates a characteristic cell based on the type of characteristic located at the specified index path.
        UITableViewCell GetCellForCharacteristicCell(UITableView tableView, NSIndexPath indexPath)
        {
            HMCharacteristic characteristic = Service.Characteristics [indexPath.Row];

            var reuseIdentifier = characteristicCell;

            if ((characteristic.IsReadOnly() || characteristic.IsWriteOnly()) && !allowsAllWrites)
            {
                reuseIdentifier = characteristicCell;
            }
            else if (characteristic.IsBoolean())
            {
                reuseIdentifier = switchCharacteristicCell;
            }
            else if (characteristic.HasPredeterminedValueDescriptions())
            {
                reuseIdentifier = segmentedControlCharacteristicCell;
            }
            else if (characteristic.IsNumeric())
            {
                reuseIdentifier = sliderCharacteristicCell;
            }
            else if (characteristic.IsTextWritable())
            {
                reuseIdentifier = textCharacteristicCell;
            }

            var cell = (CharacteristicCell)tableView.DequeueReusableCell(reuseIdentifier, indexPath);

            cell.ShowsFavorites = showsFavorites;
            cell.Delegate       = Delegate;
            cell.Characteristic = characteristic;

            return(cell);
        }
コード例 #2
0
 public static bool IsInteger(this HMCharacteristic self)
 {
     return(self.IsNumeric() && !self.IsFloatingPoint());
 }