Giter Club home page Giter Club logo

tdbadgedcell's Introduction

TDBadgedCell

Version Carthage compatible Platform License Downloads

TDBadgedCell grew out of the need for TableViewCell badges and the lack of them in iOS (see the article explaining this on TUAW Engadget). Recently the project has been re-written in Swift and much simplified.

 

Usage and examples

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:

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  var cell = tableView.dequeueReusableCell(withIdentifier:"BadgedCell") as? TDBadgedCell;
  if(cell == nil) {
    cell = TDBadgedCell(style: .default, reuseIdentifier: "BadgedCell");
  }

  // ...
  
  return cell!
}

You can modify the badges appearance in a number of different ways.

  • Setting badge value

    To set the content of your badge (String) simply do:

    cell.badgeString = "Hello, World!"
  • Changing the badge color

    You can set badgeColor and badgeColorHighlighted to modify the colour of the badges:

    cell.badgeColor = .orange
    cell.badgeColorHighlighted = .green
  • Setting the font size and text color

    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:

    cell.badgeTextColor = .black;
    cell.badgeFontSize = 18;
  • Corner radius

    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:

    cell.badgeRadius = 0;
  • Badge Offset

    You can set the badge's offset from the right hand side of the Table View Cell

    cell.badgeOffset = CGPoint(x:10.0, y:0)
  • Badge Text Offset

    You can add an offset to the text within the badge

    cell.badgeTextOffset = 5.0

If you have any feedback or feature requests, simply open an issue on the TDBadgedCell github repo.

Licence and that stuff

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.

Please note: If you are using TDBadgedCell in your project please make sure you leave credit where credit is due. Chances are I won't notice if you haven't left credit but karma will…

tdbadgedcell's People

Contributors

0xacdc avatar ahanmal avatar andruu avatar chris-babelbark avatar coryallegory avatar danielebogo avatar emrcftci avatar exalted avatar frisocki avatar fulldecent avatar guidev avatar hanawat avatar irvis avatar jeffreyjackson avatar jkubicek avatar julientherier avatar kishikawakatsumi avatar markcleonard avatar mjwybrow avatar nbonamy avatar pierrephi avatar rogymd avatar ryanmasondavies avatar scottcc avatar t-pham avatar tchaikov avatar tmdvs avatar tonymillion avatar valeriomazzeo avatar xzenon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tdbadgedcell's Issues

Using showShadow impacting scroll performance

Hi,

I am encountering an issue with performance from TDBadgedCell when enabling the showShadow property. When I set showShadow to YES in my table and scroll on device, Instruments measures at around 15 FPS for Core Animation performance. Using the same app and either setting showShadow to NO or removing the property setting, my app registers around 60 FPS.

Can you suggest if there is anything other than not using the property that I can do to improve performance of scrolling?

Thanks,
Steve

sizeWithFont: deprecated

In this code

CGSize numberSize;
if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) {
    numberSize = [self.badgeString sizeWithAttributes:@{ NSFontAttributeName:font }];
} else {
    numberSize = [self.badgeString sizeWithFont:font];
}

Even though iOS 7 is checked for and it uses the new API, the else case generates an undesirable compiler warning. Perhaps another approach may be prefered here.

Dynamic Type Support

I am converting a project to support dynamic type and it would be great to have this supported. I can fork the project and create a PR, but I can't wait terribly long to have ti reviewed since this project is time sensitive. Thoughts?

Cartage Compatibility

It'd be super cool if you included Carthage compatibility. Whenever I try to build it, I get the following error: Dependency "TDBadgedCell" has no shared framework schemes for any of the platforms: iOS

Thanks!

Cells seemed to be cached

Hi there,

I've been using TDBadgedCell now for a while, and it seems like the cells are being cached.

When the method cellForRowAtIndexPath gets called, after getting a cell from the reuse queue, I immediately do a [cell setBadgeString:nil];
This works great, and the badge gets turned off. However, if I have more than 1 cell, after getting the requested cell, the other cells seem to use some cached value. This only happens after selecting the cell.

The code to setup the cell is as follows:

TDBadgedCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
    cell = [[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleValue1     reuseIdentifier:CellIdentifier];

[cell setBadgeString:nil];
[[cell textLabel] setBackgroundColor:[UIColor clearColor]];
[[cell textLabel] setTextColor:[UIColor whiteColor]];
[[cell textLabel] setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:14]];
[[cell textLabel] setShadowColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:.14]];
[[cell textLabel] setShadowOffset:CGSizeMake(1.0, 1.0)];

So the flow of how i see the caching goes like this.
Create 3 cells with badges all set initially to nil.
I receive data, from 3 sources, then I set the badges to 3 different values.
Upon touching a cell, i set the badge to nil. I do this to each and every 3 cells.
Then I receive data from only one source. I then set the badge count to this value.
Upon setting the value, the other 2 cells now seem to have their data set, but form completely old value. Here is where i seem to get the cached data.

I'm really not sure how to debug this either. I set a debug point on cellForRowAtIndexPath to see if the other cells were being updated, but only the cell that was tapped gets updated by cellForRowAtIndexPath.

I've done some googling on this, and it seems some other users have ran into a similar problem. One example is here:
http://stackoverflow.com/questions/2215075/caching-issues-with-tdbadgedcell
However, this comes from 2010, and Im not sure if this issue was noticed before and fixed.

Can anyone shed any light on this? Is the information i posted above enough? Or do you need more?

Thank you

Readme font example

The fontSize is a property of TDBadgeView, but the example references it as a property of TDBadgedCell.

cell.fontSize = 18;

Shadows and iOS7

iOS7 has introduced cell highlighting/selection changes which don't play nicely with the showShadow property. When cells are highlighted, the label text color doesn't change to white, and the implementation as it currently stands will show text shadows at all times.

IMO the simplest fix would be to eliminate text shadowing when running under iOS7, by wrapping the if(self.showShadow) code block in the SetHighlighted:animated: override, with a check for current iOS version.

Otherwise you'd need to manually change the text color to white when selected (or it looks pretty bad), track the initial label colors to change them back, handle changing the textLabel layers back to normal following highlight:NO and copy all that code into setSelected:animated: as well. At that point you're messing with a decent amount of expected UITableViewCell behavior under the new OS.

Or just don't use showShadow under iOS7 :)

ios simulator screen shot oct 16 2013 12

set badge String hide all title

This appears only on iPad, when I set the badgeString of an cell, the title and the badge all disappear and only show a white color

iOS 7 Badge Offset Not Working

badgeLeftOffset and badgeRightOffset do not seem to be working in iOS 7. Badge position does not move no matter what settings are entered.

deselectRowAtIndexPath: animated: doesn't animate correctly

In the 0.6 release, a badge of colour [UIColor blueColor] appeared a strong blue color;

In the 0.9 release, the same badge actually appears a blue-grey when not highlighted - which does admittedly look better.

However, when deselectRowAtIndexPath: animated: is called, the badge correctly fades in time with the cell-highlighting from the badgeColorHighlighted colour to the actual specified badgeColor (e.g. blueColor) but then snaps to the new (blue-grey) colour once this animation is complete, which is disconcerting.

This looks wrong and clearly isn't what was intended.

TDBadgedCell performance issue

Only want to ask question:
When scrolling tableView, while there is a badge on cell, there is serious performance issue, flickering, and it's sometimes annoying. Any solution of this

private func drawBadge()

Badge in Arabic Localisation in iOS7 Not Working

Hello, whenever I select Arabic localization in the General>International>Language>Arabic the Badge number inside the badge is offset to the right and not visible. The Badge itself is displayed correctly, it is the number inside the badge that is offset. This only happens in iOS7, it did not do this in previous iOS. Thanks for a resolution.

unrecognized selector to instance

I have included the class but when i try to use cell.badgestring = @"Test"; in the cellForRowAtIndexPath i only get the below error. I have tried to gone over your project to see what i have done wrong but cant figure it out.

2013-04-22 16:17:49.695 ProjectName[9565:c07] -[UITableViewCell setBadgeString:]: unrecognized selector sent to instance 0x75331c0 2013-04-22 16:17:49.696 ProjectName[9565:c07] **\* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell setBadgeString:]: unrecognized selector sent to instance 0x75331c0' **\* First throw call stack: (0x15a7012 0x12b4e7e 0x16324bd 0x1596bbc 0x159694e 0x3c33 0x2b38fb 0x2b39cf 0x29c1bb 0x2acb4b 0x2492dd 0x12c86b0 0x112fc0 0x10733c 0x107150 0x850bc 0x86227 0x868e2 0x156fafe 0x156fa3d 0x154d7c2 0x154cf44 0x154ce1b 0x26087e3 0x2608668 0x1f8ffc 0x226d 0x2195) libc++abi.dylib: terminate called throwing an exception

Cell selection style

Thanks for your nice class.
I've noticed a small problem while cell selectionStyle property set to UITableViewCellSelectionStyleNone the badge still uses highlighted color an becomes invisible with default colors.
I've added

if((parent.selectionStyle != UITableViewCellSelectionStyleNone) && (parent.highlighted || parent.selected)){

to drawRect but i guess you may add a better solution in futher releases :)

Good luck

'UITableViewCell' does not have a member named 'badgeString'

My project using Swift. The problem is I got this error message when I trying to set badgeString.

Error message

/Users/MNurdin/Documents/iOS/XXXXX/Controllers/ViewController.swift:55:9: 'UITableViewCell' does not have a member named 'badgeString'

My code

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("BuzzCell", forIndexPath: indexPath) as! UITableViewCell //1
        cell.textLabel?.text = buzzs[indexPath.row]
        cell.badgeString = "130990"; //error message here
        return cell
    }

I already import the library via bridging header. Please advice. Thank you.

Crashes when TDBadgedCells scroll out of view

I have a piece of code which has worked fine with TDBadgedCell whilst badgeNumber was the correct property.

I've updated to the latest revision of TDBadgedCell and changed referenced of badgeNumber to badgeString, and now find that the application crashes with:

2011-02-05 22:18:21.167 myApp[1776:307] *** -[CFString sizeWithFont:]: message sent to deallocated instance 0x461de70
(gdb) where
\#0  0x35823910 in ___forwarding___ ()
\#1  0x3587ba58 in __forwarding_prep_1___ ()
\#2  0x000371be in -[TDBadgeView drawRect:] (self=0x46f0000, _cmd=0x344b641d, rect={origin = {x = 0, y = 0}, size = {width = 24, height = 18}}) at /Users/Stuart/Documents/Development/iOS Apps/myApp/Classes/TDBadgedCell.m:46
\#3  0x341b82d8 in -[UIView(CALayerDelegate) drawLayer:inContext:] ()
\#4  0x3107b304 in -[CALayer drawInContext:] ()
\#5  0x3107a204 in -[CALayer _display] ()
\#6  0x3107a070 in -[CALayer display] ()
\#7  0x31079fb6 in CALayerDisplayIfNeeded ()
\#8  0x3106f574 in CA::Context::commit_transaction ()
\#9  0x3106f382 in CA::Transaction::commit ()
\#10 0x31092f9c in CA::Transaction::observer_callback ()
\#11 0x3580ac58 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
\#12 0x3580aacc in __CFRunLoopDoObservers ()
\#13 0x358020ca in __CFRunLoopRun ()
\#14 0x35801c86 in CFRunLoopRunSpecific ()
\#15 0x35801b8e in CFRunLoopRunInMode ()
\#16 0x320c84aa in GSEventRunModal ()
\#17 0x320c8556 in GSEventRun ()
\#18 0x341dc328 in -[UIApplication _run] ()
\#19 0x341d9e92 in UIApplicationMain ()
\#20 0x00002fc4 in main (argc=1, argv=0x2fdff33c) at /Users/Stuart/Documents/Development/iOS Apps/myApp/main.m:45

... line 46 being:

CGSize numberSize = [countString sizeWithFont: font];

... after setting a break-point on this line, the problem seems to be with countString, which is given as being of type '_NSZombie__CFString *'.

P.S. With the relevant compiler options enabled, line 32 is being complained about for "Using the result of an assignment as a condition without parentheses".

Adopt layout from https://github.com/fulldecent/swift5-module-template

(Posting issue to confirm it is in the project scope. I am planning to commit resources to work on this.)


A modern project layout for Swift modules is defined at https://github.com/fulldecent/swift5-module-template

Work plan

  • Study best practices at link above
  • Apply the "Recipe" from the Swift 5 Module Template to this project
  • Ensure that PR does not change the current development team

Follow-on work

  • Make a minor version feature release with this updated project

podspec needs update?

The current podspec on CocoaPods has a wrong source_files path and points to the old version 3.0.
Also, the podspec file is not on this GitHub repo either.

Could you please provide a fix for this? Thanks.

Scrolling Performance

As soon as scrolling is involved, using TDBadgedCell, it becomes jittery and doesn't feel smooth. Using instruments to profiling Core Animation (Color Blended Layers), you can see, that TDBadgedCell doesn't really blend well. Looking through the source code, I don't actually see why Core Animation cannot blend it. You custom draw your contentView, so it shouldn't be a problem, right?

[TDBadgeView setFontSize:]: unrecognized selector sent to instance

Got an issue saying

-[TDBadgeView setFontSize:]: unrecognized selector sent to instance 0x9de10c0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TDBadgeView setFontSize:]: unrecognized selector sent to instance 0x9de10c0'

Changed this in TDBadgedCell.h

@Property (nonatomic, assign) CGFloat fontSize;
@Property (nonatomic, assign) CGFloat radius;

To

@Property CGFloat fontSize;
@Property CGFloat radius;

Memory leak on non ARC environment

When using Xcode 5 analyzer, I get the following warning:

...TDBadgedCell.m:99:5: Potential leak of an object stored into 'paragraph'

There is also actual memory leak when profiling using Instruments!

This is the current code:

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
    NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
    [paragraph setLineBreakMode:NSLineBreakByClipping];
    [__badgeString drawInRect:bounds withAttributes:@{ NSFontAttributeName:font,
                                                       NSParagraphStyleAttributeName:paragraph}];
#else
    [__badgeString drawInRect:bounds withFont:font lineBreakMode:TDLineBreakModeClip];
#endif

I was thinking about adding the following lines:

#if !__has_feature(objc_arc)
    [paragraph release];
#endif

So final code will look as follows. What do you think?

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
    NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
    [paragraph setLineBreakMode:NSLineBreakByClipping];
    [__badgeString drawInRect:bounds withAttributes:@{ NSFontAttributeName:font,
                                                       NSParagraphStyleAttributeName:paragraph}];
#if !__has_feature(objc_arc)
    [paragraph release];
#endif

#else
    [__badgeString drawInRect:bounds withFont:font lineBreakMode:TDLineBreakModeClip];
#endif

Create separate LICENSE file

Could kindly create a separate LICENSE file with the license text and link that one from your Cocoapods spec file?

We are showing the Acknowledgements.plist file autogenerated by Cocoapods and it is somewhat inconvenient that the whole TDBadgedCell README.md gets pasted into it.

EXC_BAD_ACCESS at [__badgeString release]

Hi,

Randomly, my app reports an EXC_BAD_ACCESS on line 137 of TDBadgedCell.m. I'm using the latest one from CocoaPods. I think that it happens every 5th time a single badge is updated.

The line is:

- (void) dealloc
{
    __parent = nil;

#if !__has_feature(objc_arc)

    [__badgeString release];
    [__badgeColor release];
    [__badgeTextColor release];
    [__badgeColorHighlighted release];

    [super dealloc];
#endif
}

This is odd that this line is even called as I have ARC enabled. Running it with Zombies reports

-[CFString release]: message sent to deallocated instance

Any ideas?

Thanks,
Ahan

color of font

i found a way so you can always set the color of the string in the badge, just in the end of init badgeView (imageView) do this trick:
badgeView.backgroundColor = UIColor.white (change the color as you want)
badgeView.layer.cornerRadius = CGFloat(badgeRadius)

Swift 4.2 errors

There are many renamed classes in Swift 4.2 so you need to update the project. Here is the list:

  • UIFontTextStyle has been renamed to UIFont.TextStyle
  • NSAttributedStringKey has been renamed to NSAttributedString.Key

Thanks!

Why is an line here....[has snapshot]

Default tableviewcontroller;
Basic tableviewcell;

[cell.textLabel setText:group.name];
[cell.detailTextLabel setText:[NSString stringWithFormat:@"%ld", (long)group.count]];

2014-03-29 20 35 50

Badge display issue for right-to-left languages on iOS 7

There is a display issue when localized language direction is right-to-left. (i.e. Hebrew, Arabic). The reason is that NSMutableParagraphStyle alignment property is set according to the current localization.

English localization:
image

Hebrew localization:
image

The current code is:

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
    NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
    [paragraph setLineBreakMode:NSLineBreakByClipping];
    [__badgeString drawInRect:bounds withAttributes:@{ NSFontAttributeName:font,
                                                       NSParagraphStyleAttributeName:paragraph}];
#else
    [__badgeString drawInRect:bounds withFont:font lineBreakMode:TDLineBreakModeClip];
#endif

I recommend adding the following line:

    paragraph.alignment = NSTextAlignmentLeft;

So final code should look as follows:

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
    NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
    [paragraph setLineBreakMode:NSLineBreakByClipping];
    paragraph.alignment = NSTextAlignmentLeft;
    [__badgeString drawInRect:bounds withAttributes:@{ NSFontAttributeName:font,
                                                       NSParagraphStyleAttributeName:paragraph}];
#else
    [__badgeString drawInRect:bounds withFont:font lineBreakMode:TDLineBreakModeClip];
#endif

iOS 7.1 Breaks View Over Badge Text

I just downloaded the project, when I ran the test script and ran it on my own project, the text is below the badge part and is not shown, I can see the text if I select a cell.

Feature Request: Activity Indicator

Just wanted to get feedback about this feature. Back in 2015, my colleague added the ability to show an activity indicator in place of the badge to start. We do this because need to get the badge value from a remote server and we want the user to see that the app is doing something in the meantime. What do you think about adding this feature? I can try to do the work, just wanted to gauge interest.

Text color

This might be a silly question, if we have a table that is not the standard white, who can we set the text color within the badge.

It appears that it is transparent, I'm just trying to get it to be a different color.

badgeColor and badgeTextColor do not change color :(

hi,

this is awesome work guys ! thanks for doing this :)

i try to implement the tdbadgecell in my little project and it works, but i'm unable to change the color about the badge and the text in the badge.

i try to use this code :

cell.badgeColor = [UIColor whiteColor];
cell.badgeTextColor = [UIColor blackColor];

but nothing happend, it just change color when i tap the cell.

Thanks for any help.
(sorry for my bad english)

Cell separator does not appear full width in group style UITableView.

Describe the bug

The standard gray cell separator does not appear full width when using a group styled UITableView.

To Reproduce

Add a TDBadgedCell to a group style UITableView. Add a badge string.

Expected behavior

The cell separator should appear with the standard width, connecting to the right side of the screen.

Screenshots

스크린샷 2020-07-13 오후 3 07 51

The first cell is a TDBadgedCell. The other cells are vanilla UITableViewCell instances.

Additional context

  • XCode 11.3.1
  • Swift 5

Crash when TDBadgedCell is released on non-ARC environment

This is the current code:

- (void) setBadgeString:(NSString *)badgeString
{
    __badgeString = badgeString;
#if __has_feature(objc_arc)
    __badge.badgeString = [__badgeString copy];
#else
    __badge.badgeString = [[__badgeString copy] autorelease];
#endif
    [__badge setNeedsDisplay];
    [self layoutSubviews];
}

As you can see, the first line of the function is:

__badgeString = badgeString;

This is incorrect code in non ARC environment, as the __badgeString member variable is not retained, yet it is being released later on in the Dealloc() method.

Recommended fix:

- (void) setBadgeString:(NSString *)badgeString
{
#if __has_feature(objc_arc)
    __badgeString = badgeString;
    __badge.badgeString = [__badgeString copy];
#else
    [__badgeString release];
    __badgeString = [badgeString retain];
    __badge.badgeString = [[__badgeString copy] autorelease];
#endif
    [__badge setNeedsDisplay];
    [self layoutSubviews];
}

Dequeing cells - Bad Access Issue

Hi,

Dequeing previously created TDBadgedCells keeps failing consistently with BAD_ACCESS error. If I create a cell every time, the issue doesn't occur. Here is the code block:

        //cell = [tableView dequeueReusableCellWithIdentifier:StoreCellIdentifier];
        //if (cell == nil) 
        {
            cell = [[[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:StoreCellIdentifier] autorelease];

            cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
            cell.textLabel.font=[UIFont systemFontOfSize:15.0];             
        }

        TDBadgedCell *tCell = (TDBadgedCell *) cell;

        NSString *detailText = [NSString stringWithFormat:@"%d", [item.ItemsToShop count]];
        [tCell setBadgeNumber: detailText];

This works, but if I uncomment the first two lines, and try to reuse the cells, the exception occurs in the call to setBadgeNumber (last line of code). I debugged and ensured that the variable "detailText" has correct values in all instances.

badgeString EXC_BAD_ACCESS when a non-constant string is set

Hey Tim,

this serious issue is probabily related to my lack of good knowledge in Objective-C programming, so I wanted to let you know about this on thing that I've noticed:

If you set badgeString with a string constant your code works just fine, but if you set it's value with a NSString object, any action (scroll, tap, etc.) will result in EXC_BAD_ACCESS on the table.

Code example:

cell.badgeString = @"New!"; // This works

cell.badgeString = [NSString stringWithFormat:@"New!"]; // Crash! ;-(

What do you think? Can you fix it please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.