You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To set the content of your badge (String) simply do:
15
+
## Usage and examples
16
+
TDBadgedCell is designed to be a drop in replacement to UITableViewCell with the added benifit of a simple badge on the right hand side of the cell, similar to those you'll find in Mail.app and Settings.app. All you need to do to implement TDBadgedCell is supply a TDBadgedCell instance in your `cellForRowAt indexPath:` method:
You can set _badgeColor_ and _badgeColorHighlighted_ to modify the colour of the badges:
31
+
You can modify the badges appearance in a number of different ways.
22
32
23
-
```Swift
24
-
cell.badgeColor= UIColor.orangeColor()
25
-
```
33
+
-### Setting badge value
34
+
To set the content of your badge (String) simply do:
26
35
27
-
You can also specify a border radius and font size for your badges:
36
+
```Swift
37
+
cell.badgeString="Hello, World!"
38
+
```
28
39
29
-
```Swift
30
-
cell.badgeRadius=9;
31
-
cell.badgeFontSize=18;
32
-
```
40
+
-### Changing the badge color
41
+
You can set _badgeColor_ and _badgeColorHighlighted_ to modify the colour of the badges:
42
+
43
+
```Swift
44
+
cell.badgeColor= .orange
45
+
cell.badgeColorHighlighted= .green
46
+
```
47
+
48
+
-### Setting the font size and text color
49
+
By default the badge text will be clipped out of the badge background allowing you to see through to the background colour beneath. However you can specify a text color manually along with the badges font size:
50
+
51
+
```Swift
52
+
cell.badgeTextColor= .black;
53
+
cell.badgeFontSize=18;
54
+
```
55
+
56
+
-### Corner radius
57
+
You can modify the badges corner radius allowing you to change the badges shape from the default "pill" shape to a square or rounded rectangle:
58
+
59
+
```Swift
60
+
cell.badgeRadius=0;
61
+
```
62
+
63
+
If you have any feedback or feature requests, simply [open an issue](https://github.com/tmdvs/TDBadgedCell/issues) on the TDBadgedCell github repo.
33
64
34
65
## Licence and that stuff
35
66
TDBadgedCell is a free to use class for everyone. I wrote it so people could have the badges Apple never provided us with. If you modify the source please share alike and if you think you've improved upon what I have written I recommend sending me a pull request.
0 commit comments