Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Graham Cox
Hmm, you’ll need to use the CGAffineTransform because it has a richer set of functions than CATransform3D. This will only work if the 3D transform can be converted to a CGAffineTransform, which it can if the rotation is purely in the 2D plane - i.e. no Z transformations. CGAffineTransform cgt

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
Alright, I got something now that I believe works. *let transform:CATransform3D = innerRing.layer.presentation()!.transform* *let angle: CGFloat = atan2(transform.m12, transform.m11)* *var testAngle = radiansToDegress(radians: angle)* *if testAngle < 0 {* *testAngle = 360 + testAngle* *}* *pri

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
I don't follow. On Tue, Mar 14, 2017 at 11:29 PM Graham Cox wrote: > Get the final transform, then use it to transform an angle of 0. The > result is the angle. > > —Graham > > > > > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki wrote: > > > > Once done (I dispatch after the randomSpeed duration)

Re: Auto-sized table cells, for macOS

2017-03-14 Thread Quincey Morris
On Mar 14, 2017, at 18:26 , Daryle Walker wrote: > > You’d think that this would be a solved problem…. It sort of is. I think you can find a solution on stackoverflow.com (which is where I got the idea from IIRC) but you have to wade through the out of date stuff to

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Graham Cox
Get the final transform, then use it to transform an angle of 0. The result is the angle. —Graham > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki wrote: > > Once done (I dispatch after the randomSpeed duration), I'd like to > determine the angle it's currently at. > > *let transform:CATransfo

Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
I have a view that I am rotating a lot, often more than 360 degrees (spins around a few times). Each time it stops, I want to determine the resulting "visual" angle. How do I go about doing that? rotateView is a configured CABasicAnimation: *let rotateView = CABasicAnimation()* *let randonAngle =

Auto-sized table cells, for macOS

2017-03-14 Thread Daryle Walker
I’ve read about techniques to make the size of a table cell expand to fit its text, but they all were based on iOS’s UITableView. Is there a similar trick using auto-layout for macOS’s NSTableView? I’m using Cocoa Bindings and do not have a table-view delegate. You’d think that this would be a

Re: NSMutableData +dataWithLength: sets errno?

2017-03-14 Thread Carl Hoefs
> On Mar 14, 2017, at 4:27 PM, Greg Parker wrote: > >> >> On Mar 14, 2017, at 4:08 PM, John McCall > > wrote: >> >>> On Mar 14, 2017, at 7:00 PM, Carl Hoefs >> > wrote: >>> macOS 10.12.3, Xcode 8.2.1, ObjC >>> >>> I'm finding t

Re: NSMutableData +dataWithLength: sets errno?

2017-03-14 Thread Greg Parker
> On Mar 14, 2017, at 4:08 PM, John McCall wrote: > >> On Mar 14, 2017, at 7:00 PM, Carl Hoefs >> wrote: >> macOS 10.12.3, Xcode 8.2.1, ObjC >> >> I'm finding the following line to be problematic: >> >> NSMutableData *myData = [NSMutableData dataWithLength:80]; >> >> I assume this ends up

Re: NSMutableData +dataWithLength: sets errno?

2017-03-14 Thread John McCall
> On Mar 14, 2017, at 7:00 PM, Carl Hoefs > wrote: > macOS 10.12.3, Xcode 8.2.1, ObjC > > I'm finding the following line to be problematic: > >NSMutableData *myData = [NSMutableData dataWithLength:80]; > > I assume this ends up calling calloc(3) to allocate and zero out the data. > But fo

NSMutableData +dataWithLength: sets errno?

2017-03-14 Thread Carl Hoefs
macOS 10.12.3, Xcode 8.2.1, ObjC I'm finding the following line to be problematic: NSMutableData *myData = [NSMutableData dataWithLength:80]; I assume this ends up calling calloc(3) to allocate and zero out the data. But for some reason, it's always setting errno to a seemingly random nonze