Skip to content

Instantly share code, notes, and snippets.

View caldofran's full-sized avatar

Rubén Méndez caldofran

View GitHub Profile
@caldofran
caldofran / UIView+IBAddons.m
Created February 10, 2015 12:20
Extension to enjoy of custom properties in Interface Builder
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface UIView (IBAddons)
// You could add more properties like that to have your custom properties in IB
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;
@end
@implementation UIView (IBAddons)
- (CGFloat)cornerRadius
@caldofran
caldofran / TestFlightBuildDetection
Created January 26, 2015 07:52
If you want your app to detect whether it’s running on a TestFlight build
[[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt”];
- (CGSize)sizeForCellAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [self configureCommentCell:self.offScreenCommentCell forItemAtIndexPath:indexPath];
CGSize fittingSize = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
return CGSizeMake(self.collectionView.bounds.size.width, fittingSize.height);
}
@caldofran
caldofran / gist:9763845
Created March 25, 2014 15:12
bug en appdelegate
- (void)changesSaved:(NSNotification *)notification {
if ([NSThread isMainThread]) {
[self changesSavedOnMainThread:notification];
}else{
@weakify(self);
dispatch_async(dispatch_get_main_queue(), ^{
@strongify(self);
[self changesSavedOnMainThread:notification];
});
}