iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Bug in UITableView ( deleteSections:withRowAnimation: )?

I have problems using this UITableView method: – (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation First the documentation says: animation: YES to animate the deletion of sections, otherwise NO. But the parameter animation is actually of type enum UITableViewRowAnimation, not BOOL!? So how can I disable the animation? I’ve tried NO and UITableViewRowAnimationNone. Nothing works. The section deletion is […]

Core Data keyPathsForValuesAffectingValueForKey only calling relationships, not attributes

I am using Core Data to model an entity which has both attributes and relationships. I would like to make one of the attributes dependent on two other relationships. The Core Data FAQ and several other examples use +(NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key for this purpose. However, this only seems to be called for all of my […]

NSMutableAttributedString's attribute NSStrikethroughStyleAttributeName doesn't work correctly in iOS8

I have a mutable attributed string without NSStrikethroughStyleAttributeName attribute like this: NSMutableAttributedString *str1 = [[NSMutableAttributedString alloc] initWithString:@”aaaa” attributes:@{NSStrikethroughStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]}]; and another mutable attributed string with NSStrikethroughStyleAttributeName attribute like this: NSMutableAttributedString *str2 = [[NSMutableAttributedString alloc] initWithString:@”bbbb”]; and a whole string containing two strings above: NSMutableAttributedString *labelString = [[NSMutableAttributedString alloc] init]; [labelString appendAttributedString:str1]; [labelString appendAttributedString:str2]; when I […]

Why does iOS auto layout lead to apparent rounding errors on pre-Retina displays (unit test included)

I’m currently having a hard time understanding why the following unit test fails on an iPad 2. Auto layout seems to slightly (by 0.5 points) mis-position view inside superview relative to the exact centering that’s required by two layout constraints. What seems especially strange is that the crucial test (but-last assertion) passes on an iPhone […]

how to draw CALayer with line path like simulate eraser effect?

I want to simulate eraser effect with touch event to show a image that behind something block on top, eg, gray color; Something like that: I have find for a long time for the solution but I can’t do it well. following is my custom view code: CustomView.m: -(id)initWithCoder:(NSCoder *)aDecoder { if (self = [super […]

Does Swift support aspect oriented programming?

I am an iOS developer trying to learn aspect oriented programming but does Swift support aspect oriented programming?

Facebook login always comes back as cancelled. (iOS Swift)

I’m currently trying implement Facebook login using the 4.0 version of the SDK, this also happens with the 3.+ version. When I call logInWithReadPermissions (4.0 version) or openActiveSessionWithReadPermissions (3.+ version). The closure/block is called immediately with isCancelled (4.0 version) and ClosedFailedLogin (3.+ version) before the user can make a selection (cancel or ok). I thought […]

Why use registerDefaults: instead of setValue:forKey:?

When I’m setting up the default preferences for my app, I’m doing the following: 1) Reading Root.plist from inside Settings.bundle into a dictionary. 2) I test if a preference is set, and if not I’m registering my defaults dictionary via [NSUserDefaults standardUserDefaults] registerDefaults:] Problem is, defaults registered with registerDefaults: do not go to the persistent […]

UIAlertController tint color defaults to blue on highlight

I’m use the following code to present a UIAlertController action sheet with the item text as red. I’ve used the tint property to set the color. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; alertController.view.tintColor = [UIColor redColor]; The text color seems to be defaulting to blue on highlight or selection. Is this normal and how […]

PBEWithMD5AndDES Encryption in iOS

I’m having an issue with PBEWithMD5AndDES encryption in iOS. I’ve got my strings encrypting and decrypting using this, The problem is I get different encrypted values depending on which class my methods are in. For example, I moved all the encryption methods into a helper class and ran it. I noticed I was getting […]