Answer by kubi for Subclassing UIButton to handle clicks
I think there are better solutions to this problem than what you've proposed, but to answer your question directly: A subclass of UIButton observes touch events the same way that everyone else observes...
View ArticleAnswer by kubi for Convert a bit array to a struct array in Swift
Thanks to @GoZoner's hint, I found this thread on Apple DevForums. Below is my final, working, solution.struct Pixel { let r: UInt8 let g: UInt8 let b: UInt8 let a: UInt8}let data: CFData! = ...let...
View ArticleAnswer by kubi for '[CLPlacemark]?' is not convertible to '[CLPlacemark]' ->...
In Xcode 7.0, Objective-C has generic arrays, so your placemarks array is no longer [AnyObject]? but is now [CLLocation]?. You don't need to cast the array, you can just unwrap the optional. With the...
View ArticleAnswer by kubi for "Does not conform to protocol" error when extending...
What I ended up doing was creating a protocol extension that creates the necessary method that NSURLSession requires.extension NSURLSession : URLSession { func dataTaskWithURL(url: NSURL,...
View ArticleAnswer by kubi for Lexical or Preprocessor Issue error (UIKit/UIKit.h file...
I was having the same issue with a framework target, building for iOS. I solved this by setting the "Base SDK" in my build configs to something reasonable.
View ArticleUITests in Xcode 7 finds wrong 'Next' button
I have a test that looks like the following:func testNextButtonDisabled() { let app = XCUIApplication() XCTAssertFalse(app.buttons["Next"].enabled)}This test fails because, in addition to my own "Next"...
View ArticleAnswer by kubi for UITests in Xcode 7 finds wrong 'Next' button
The specific solution to this problem is to look for elements that are descendants of the main window.func testNextButtonDisabled() { let app = XCUIApplication()...
View ArticleConvert a bit array to a struct array in Swift
Here's what I've got currently. I'm wondering if there's a more elegant way to do it or, better yet, a way to cast my array to the required type without iterating over the entire structure. My input is...
View ArticleAnswer by kubi for How to handle drag events on iphone and ipad with...
Apple's Developer pages have a lot of good info on handling just these types of issues.Handling Events
View ArticleAnswer by kubi for Objective C: Send email without leaving app
Yes. Use the MFMailComposeViewController.// From within your active view controllerif([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailCont = [[MFMailComposeViewController...
View Articlegrep'ing output from continuously updated output
I'm trying to write a simple script around Lame to customize the program for my specific uses. What I'd like to do is parse out just the percent completeness from the Lame output.Here's what the line...
View ArticleAnswer by kubi for How can I detect if an iPhone is rotating while being face...
When the phone is stationary the sum of the acceleration vectors should be +1. When the phone is rotating (assuming the sensor is off-center) the sum of the vectors should be more than 1 and...
View ArticleAnswer by kubi for How to .gitignore all files/folder in a folder, but not...
You can't commit empty folders in git. If you want it to show up, you need to put something in it, even just an empty file.For example, add an empty file called .gitkeep to the folder you want to keep,...
View ArticleSQL Server database change workflow best practices
The BackgroundMy group has 4 SQL Server Databases: ProductionUATTestDevI work in the Dev environment. When the time comes to promote the objects I've been working on (tables, views, functions, stored...
View ArticleUIImagePickerController doesn't fill screen
I'm adding a custom overlay to the UIImagePickerController and there is a persistant black bar at the bottom of the view. Here is my code to instantiate the controller.- (UIImagePickerController...
View ArticleCan you attach a UIGestureRecognizer to multiple views?
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTapTap:)];[self.view1 addGestureRecognizer:tapGesture];[self.view2...
View ArticleHow do you dismiss the keyboard when editing a UITextField
I know that I need to tell my UITextField to resign first responder when I want to dismis the keyboard, but I'm not sure how to know when the user has pressed the "Done" key on the keyboard. Is there a...
View ArticleWhat is the best practice for dealing with passwords in git repositories?
I've got a little Bash script that I use to access twitter and pop up a Growl notification in certain situations. What's the best way to handle storing my password with the script? I would like to...
View ArticleAnswer by kubi for Git is very very slow when tracking large binary files
Garbage collect:git gcThis makes a significant difference in speed, even for small repositories.
View Article