How to pin the Public key of a certificate on iOS

In case you are in need of knowing how to extract this information from the certificate in your iOS code, here you have one way to do it. First of all add the security framework. #import <Security/Security.h> The add the openssl libraries. You can download them from https://github.com/st3fan/ios-openssl #import <openssl/x509.h> The NSURLConnectionDelegate Protocol allows you … Read more

UICollectionView current visible cell index

indexPathsForVisibleItems might work for most situations, but sometimes it returns an array with more than one index path and it can be tricky figuring out the one you want. In those situations, you can do something like this: CGRect visibleRect = (CGRect){.origin = self.collectionView.contentOffset, .size = self.collectionView.bounds.size}; CGPoint visiblePoint = CGPointMake(CGRectGetMidX(visibleRect), CGRectGetMidY(visibleRect)); NSIndexPath *visibleIndexPath = … Read more

change color navigation controller in a popover

//////////////////////////////////////// ////////////**SOLUTION**//////// //////////////////////////////////////// I’m gonna edit this post because i solved my problem and I think could be helpful share my solution here: first of all, follow this sample: http://mobiforge.com/designing/story/using-popoverview-ipad-app-development When It is done go to step two. The second step will be add a new popoverBackgroundViewClass: Add new file in your project Objective class … Read more

Cocos2D 2.0 screenshots on iOS 6

I am not sure what the GitHub version does but this code will take a screenshot and I just tested it on iOS 6 and it works fine. +(UIImage*) screenshotWithStartNode:(CCNode*)startNode { [CCDirector sharedDirector].nextDeltaTimeZero = YES; CGSize winSize = [CCDirector sharedDirector].winSize; CCRenderTexture* rtx = [CCRenderTexture renderTextureWithWidth:winSize.width height:winSize.height]; [rtx begin]; [startNode visit]; [rtx end]; return [rtx getUIImage]; … Read more