コード例 #1
0
        public static NSAttributedString AttributedStringFor(string durationText, UIFont font)
        {
            var prefixLength = DurationHelper.LengthOfDurationPrefix(durationText);
            var result       = new NSMutableAttributedString(durationText, font: font.GetMonospacedDigitFont(), foregroundColor: UIColor.Black);

            result.AddAttribute(UIStringAttributeKey.ForegroundColor, placeHolderColor, new NSRange(0, prefixLength));
            return(result);
        }
コード例 #2
0
            public void CalculatesTheLengthOfPrefixCorrectly(string duration, int expectedPrefixLength)
            {
                var prefixLength = DurationHelper.LengthOfDurationPrefix(duration);

                prefixLength.Should().Be(expectedPrefixLength);
            }