How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?

I have a UIImage (Cocoa Touch). From that, I’m happy to get a CGImage or anything else you’d like that’s available. I’d like to write this function: – (int)getRGBAFromImage:(UIImage *)image atX:(int)xx andY:(int)yy { // […] // What do I want to read about to help // me fill in this bit, here? // […] int … Read more

In Swift how to call method with parameters on GCD main thread?

In my app I have a function that makes an NSRURLSession and sends out an NSURLRequest using sesh.dataTaskWithRequest(req, completionHandler: {(data, response, error) In the completion block for this task, I need to do some computation that adds a UIImage to the calling viewcontroller. I have a func called func displayQRCode(receiveAddr, withAmountInBTC:amountBTC) that does the UIImage-adding … Read more

Is it possible to disable floating headers in UITableView with UITableViewStylePlain?

I’m using a UITableView to layout content ‘pages’. I’m using the headers of the table view to layout certain images etc. and I’d prefer it if they didn’t float but stayed static as they do when the style is set to UITableViewStyleGrouped. Other then using UITableViewStyleGrouped, is there a way to do this? I’d like … Read more

capturing self strongly in this block is likely to lead to a retain cycle

How can I avoid this warning in xcode. Here is the code snippet: [player(AVPlayer object) addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(0.1, 100) queue:nil usingBlock:^(CMTime time) { current+=1; if(current==60) { min+=(current/60); current = 0; } [timerDisp(UILabel) setText:[NSString stringWithFormat:@”%02d:%02d”,min,current]];///warning occurs in this line }]; 7 Answers 7

Autoresizing masks programmatically vs Interface Builder / xib / nib

I was in an (probably false) assumption that enabling the right margin indicator in xib is equivalent to using UIViewAutoresizingFlexibleLeftMargin inside code and so on. So, I used to think according to this snapshot: Later today I had to cross check, and stumbled upon this thread. And also the apple documentation, entitled with the section … Read more

Autolayout – intrinsic size of UIButton does not include title insets

If I have a UIButton arranged using autolayout, its size adjusts nicely to fit its content. If I set an image as button.image, the instrinsic size again seems to account for this. However, if I tweak the titleEdgeInsets of the button, the layout does not account for this and instead truncates the button title. How … Read more