Re: UiView as slider with inertia

2018-09-30 Thread Jonathan Hull
What you want is UICollectionView. Make the numbers your cells, and use -targetContentOffset(forProposedContentOffset:, withScrollingVelocity:) to provide the snapping behavior. > On Sep 30, 2018, at 8:46 PM, Eric Dolecki wrote: > > I've been tasked with coming up with a few horizontal slider

Re: UIDocumentBrowserViewController and file package documents

2017-06-21 Thread Jonathan Hull
That part is really confusing me as well (I am also using a package document). I started by using the documents directory, but I keep getting an error that the browser doesn’t have access. Then I switched to the temp directory, and now it works part of the time, and the other times I still get

Re: Can't use +initialize, now what?

2017-03-30 Thread Jonathan Hull
> On Mar 29, 2017, at 4:24 PM, Charles Srstka wrote: > >> On Mar 29, 2017, at 3:41 PM, Greg Parker wrote: >> >>> On Mar 29, 2017, at 9:02 AM, Charles Srstka >> > wrote: >>> On Mar 29, 2017, at 10:51 AM, Jens Alfke >>> > wrote: >

Re: Overriding the release mehod

2017-01-25 Thread Jonathan Hull
One of my favorite things about this list is that the standard response to a question is to ask about the underlying motivation. It shows that they are prepared to think deeply about your problem and don’t want to just give you a cookie cutter answer. One of the main signs of an intelligent pe

Re: slicing in Swift

2016-09-06 Thread Jonathan Hull
I realized my comment may not have been clear. Here is the actual code (written in Mail): var numbers: [UInt64] = … func numbers( upTo nbr: Int ) -> [UInt64] { return Array( numbers[ 0 ..< nbr ] ) } Thanks, Jon > On Sep 6, 2016, at 5:42 PM, Jonathan Hu

Re: slicing in Swift

2016-09-06 Thread Jonathan Hull
You can explicitly create an array with the slice by using ‘Array(slice)’. Honestly, I am not sure of the actual value of slices because of issues like this. I would rather have those methods return an Array which is some sort of copy on write slice internally. Thanks, Jon > On Sep 6, 2016,

Re: Dynamic-width Collection View

2016-08-10 Thread Jonathan Hull
;m open to ideas on what I should override in a layout subclass. > Particularly ones that don't require me to reimplement #1 and #2 above. > > Doug Hill > >> On Aug 10, 2016, at 2:16 PM, Jonathan Hull > <mailto:jh...@gbis.com>> wrote: >> >> Because y

Re: Simplest way to generate audio tones?

2016-05-28 Thread Jonathan Hull
a Programming Guide”, but I can find no such guide and the > mention on the page isn’t a link. > > > —Graham > > > >> On 29 May 2016, at 3:36 PM, Jonathan Hull wrote: >> >> This is way out of my area of expertise, but it appears you want AudioUni

Re: Simplest way to generate audio tones?

2016-05-28 Thread Jonathan Hull
This is way out of my area of expertise, but it appears you want AudioUnits: http://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html Thanks, Jon > On May 28, 2016, at 8:24 PM, Graham Cox wrote: > > Hi all, > > I’m looking for general pointers to the simplest/quickest way

Re: UI to allow user to scale and crop image within a circle

2016-02-23 Thread Jonathan Hull
Have you looked at cocoa controls? I am pretty sure I have seen a few open source projects that do this. www.cocoacontrols.com Thanks, Jon > On Feb 23, 2016, at 4:28 AM, Charles Jenkins wrote: > > Still struggling with this… My scrollview containing an imagevie

Re: How to record screen in iOS

2016-01-20 Thread Jonathan Hull
Believe it or not, you can do it with Quicktime player. There is a little downward facing triangle next to the record button, and if you have your iPhone/iPad plugged in, it will show them as potential recording sources… Thanks, Jon > On Jan 20, 2016, at 1:21 AM, ico wrote: > > Hi All, > Is

Re: How to create an empty stack view in code

2015-12-06 Thread Jonathan Hull
You can just do [[NSStackView alloc] initwithFrame:] > On Dec 6, 2015, at 6:23 AM, Dave wrote: > > Hi All, > > How do I create an Empty Stack View in code? The only method I can find that > that creates a Stack View is stackViewWithViews and you can’t pass nil to > this. Do I have to pass an

Re: Custom time picker

2015-12-02 Thread Jonathan Hull
Here are the relevant methods from a UICollectionViewLayout subclass. You can just subclass the standard flow layout and add this or you can make a more custom layout if desired. For context, this collectionView has a vertical strip of digits (multiple strips make an odometer… like the pickerV

Re: Generics Problem

2015-09-19 Thread Jonathan Hull
If you only need U to be a String or a Double, have you tried using a protocol instead (and then having both String & Double adhere to it). It doesn’t explain the compiler error, but it might work. I would also recommend using as? instead of as! here. Thanks, Jon > On Sep 19, 2015, at 10:54

Re: Is it possible to transfer data by using light

2015-09-16 Thread Jonathan Hull
This is how fibre optics work, so it is possible. In this case, you have to be careful not to give people seizures by blinking at the wrong frequency. The big question would be why you want to do it. It is most likely easier to transfer via wifi (also traveling at the speed of light, and optim

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
Trying to remember what I had to do to get this to work in a project a couple of years ago. Have you tried adding a constraint equaling the width of the scrollView and the clipView? Thanks, Jon > On Sep 14, 2015, at 11:11 AM, Dave wrote: > > >> On 14 Sep 2015, at 18:50

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
#x27;:LTWDetailXView:0x6318 )>”, > >" V:[DetailHeaderView]-(-2)-[DetailBodyView] (Names: > DetailBodyView:0x621805b0, DetailHeaderView:0x631809c0 )>" > ) > > Which look ok me me? > > Cheers > Dave > >> On 14 Sep 2015, at 1

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
) Thanks, Jon > On Sep 14, 2015, at 11:11 AM, Dave wrote: > > >> On 14 Sep 2015, at 18:50, Jonathan Hull wrote: >> >> You shouldn’t have to add any constraints to the direct children of a >> StackView (and in fact, you will most likely get an error if you try),

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
You shouldn’t have to add any constraints to the direct children of a StackView (and in fact, you will most likely get an error if you try), since the StackView will make its own constraints and manages them for you. My guess is that the StackView is not resizing with the ScrollView. You can t

Re: Swift generics, circular type declarations, and segfaults, oh my!

2015-09-06 Thread Jonathan Hull
I am wondering if the compiler feature which might allow this (and several other things) would be to allow implementors of a protocol to adhere to it with a more restrictive type (either a subclass or an implementer/inheritor of a returned protocol). For example: protocol Thing { var n

Getting a Popover's frame

2015-09-06 Thread Jonathan Hull
Hello, I have a UIPopoverPresentationController and I would like to get the popover’s frame in either window coordinates or the presenting controller’s view’s coordinates. A little background: The popover contains a custom color picker, and after it opens, several passthrough views representi

Re: Any native API for credit/ debit card info scan

2015-08-26 Thread Jonathan Hull
I don’t think there is a way to access this functionality in the system frameworks, but we have had good results with Card.io: https://www.card.io Thanks, Jon > On Aug 26, 2015, at 12:23 AM, Devarshi Kulshreshtha > wrote: > > In iOS 8, Apple has a new feature in Safari that allows users to s

Re: What is "TypeA -> TypeB"?

2015-07-02 Thread Jonathan Hull
It is a closure which takes TypeA and returns TypeB. Thanks, Jon > On Jul 2, 2015, at 1:29 PM, Rick Mann wrote: > > I saw this in a Swift HTTP server: > >typealias Handler = HttpRequest -> HttpResponse > > You can see the whole thing here: > > https://github.com/glock45/swifter/blo

Re: Swift 2 generics and derived types

2015-06-24 Thread Jonathan Hull
This is a problem that seems to come up a lot in swift (they really need something like “IntegerArithmeticType” that includes floats, doubles, CGFloats, etc… so we don’t have to cast for simple arithmetic). I think the trick that IntegerArithmeticType uses is that it has a common form that ever

Re: Language options: Objective-C, Swift, C or C++?

2015-06-13 Thread Jonathan Hull
> On Jun 13, 2015, at 4:42 PM, Carl Hoefs > wrote: > > Bingo. Even after reading all the posts in this thread, I still don’t know > what problem Swift addresses, and no one seems to be able to answer that > question — not even Apple in its marketing hype. Do you remember the Goto-Fail bug t

Re: Concatenating two NSIndexPath objects

2015-06-01 Thread Jonathan Hull
I found this in a category in a (very) old project of mine. You could easily speed it up by using arrays, but this version worked well enough for my needs. - (NSIndexPath*) indexPathByAddingIndexPath:(NSIndexPath*) indexPath { NSIndexPath* path = [self copy]; for (NSUInteger i = 0; i < i

Re: Constraining window width to scrolling contents with autolayout

2015-05-25 Thread Jonathan Hull
I believe this is where the constraint priorities come in. The window size will be affected by constraints with priorities larger than 500 and may override constraints under 500. Also, when dealing with ScrollViews it can get a bit tricky, so it helps to add a single view inside the scrollView

Video not playing

2015-05-24 Thread Jonathan Hull
Hello Cocoa Devs, I am a bit stumped by this, but hopefully it is an easy answer to someone who has worked with videos more. The effect I am trying to achieve is having an image of a video showing among other elements, and when the user taps the video it zooms to fullscreen and plays. Here is

Re: Tracking the retain count

2015-05-19 Thread Jonathan Hull
> On May 19, 2015, at 8:04 PM, Quincey Morris > wrote: > > Solution B: We retain each object as it enters the cache. That allows us to > selectively mark objects purgeable by releasing them again. Drawbacks: None. You still have to be really careful about threading here. How do I know which

Re: Tracking the retain count

2015-05-17 Thread Jonathan Hull
Haha. Awesome! I didn’t even know this existed… thanks for the tip :-) > On May 17, 2015, at 6:30 PM, Graham Cox wrote: > > >> On 18 May 2015, at 11:14 am, Jonathan Hull wrote: >> >> Instead of having a central object pool, have the objects adhere to a >>

Re: Tracking the retain count

2015-05-17 Thread Jonathan Hull
I would avoid messing with the retainCount. Have you looked at using NSCache to retain the objects in your pool? Other approaches that you could try: 1) Your central object pool has an array which holds a strong reference to the objects, and has a method (that can be called in a low-memory situ

Re: Stupid ! and ?

2015-04-25 Thread Jonathan Hull
> On Apr 25, 2015, at 7:59 AM, William Squires wrote: > > Where I'm running into problems is this line of code: > > func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: > NSIndexPath) -> UITableViewCell > { > var cell = tableView.dequeueReusableCellWithIdentifier(simpleTable

Re: TextView : Shifting all text down to make room for a subview

2015-04-01 Thread Jonathan Hull
Have you tried just setting the textContentInset to make room for your subview? I used that approach a couple of days ago to add room for a subview at the bottom of a UITextView and it worked like a charm. Worth a shot here too. Thanks, Jon > On Apr 1, 2015, at 2:19 PM, Seth Willits wrote: >

Re: Trying to create a 1px width NSBox

2015-03-08 Thread Jonathan Hull
If you have layers enabled, you can just use an ordinary 1pt wide NSView and set the background color of its layer to black (or whatever color you want). No need to subclass. Thanks, Jon > On Mar 8, 2015, at 12:02 PM, Patrick J. Collins > wrote: > > I am trying to create a "playhead" that

Re: How to translate this form objc to swift? (__unsafe_unretained)

2015-02-24 Thread Jonathan Hull
Off the top of my head (written in mail): for (key,value) in headers { request.setValue(value, forHTTPHeaderField: key) } Thanks, Jon > On Feb 23, 2015, at 6:55 AM, Juanjo Conti wrote: > >NSUInteger count = [headers count]; >__unsafe_unretained id keys[count], values[count]; >

Re: Idea for Improving Vibrancy

2015-02-17 Thread Jonathan Hull
If you wanted to do this, I would grab the desktop image somehow, apply the effect to it once, and then use (a shifting portion of) that image as the background of your Source View, etc…. That way there is no need to mess with additional windows, or apply the expensive effect continually. Ther

Re: Trying to create a circular button with image, but the image wasn't clipped automatically

2015-02-07 Thread Jonathan Hull
You need to set the layer’s -maskToBounds: property to YES to clip. Thanks, Jon > On Feb 7, 2015, at 10:38 PM, Aaron Lewis wrote: > > Hi, > > I'm trying to create a circular button, with an rectangular image: > >self.button.layer.borderColor = [UIColor blackColor].CGColor; >self.butt

Re: Is the button group in Safari a general widget ?

2015-01-23 Thread Jonathan Hull
UIToolbar with UIBarButtonItems? Thanks, Jon > On Jan 23, 2015, at 8:20 AM, Aaron Lewis wrote: > > Hi, > > I've seen a lot of apps like Safari. 5 buttons in the bottom > > Is that a common widget? I couldn't find it on google > > > -- > Best Regards, > Aaron Lewis - PGP: 0x13714D33 - http:

Re: NSTableView with reversed rows?

2014-10-02 Thread Jonathan Hull
Have you considered just inverting the data source? Thanks, Jon On Oct 2, 2014, at 12:45 PM, Luc Van Bogaert wrote: > Hi, > > I would like to implement a table (in a scrollview) where the first row > displays at the bottom instead of at the top, the second row above the first > and so on. H

Re: iOS app restarting from screen one. Why?

2014-06-19 Thread Jonathan Hull
My guess would be that Jens is correct. Your app is likely being killed by the system while it is in the background. I tend to run a lot of apps at once and switch between them often, so I run into this all the time. When your app is backgrounded, you should save your UI state and restore it

Re: JSONSerialization 'Garbage at end' error

2014-04-30 Thread Jonathan Hull
I also find that it is good practice to set variables returned by reference to nil before passing them. NSError *error = nil; Otherwise, they will contain garbage, and cannot reliably be tested to see if the value was set. Andy is right though, that it is better to test whether jsonObject is

Re: Protocols and forwardingTargetForSelector:

2014-02-25 Thread Jonathan Hull
The @dynamic keyword tells the compiler not to worry about it (i.e. you are promising it that you are going to handle those selectors). Thanks, Jon On Feb 25, 2014, at 3:14 PM, jonat...@mugginsoft.com wrote: > > On 25 Feb 2014, at 21:38, Greg Parker wrote: > >> On Feb 25, 2014, at 6:42 AM,

Re: NSNumber : method to return pointer to represented value

2014-02-23 Thread Jonathan Hull
On Feb 23, 2014, at 4:08 AM, jonat...@mugginsoft.com wrote: >> 1(int) and 1(float) can be represented by the same NSNumber object perfectly >> legally. > Is that true? Yes. As far as NSNumber is concerned, they are equal. They are also both equal to @(YES) which is initialized with a BOOL. On

Re: Disabling screen capture

2014-02-23 Thread Jonathan Hull
I don’t like the idea of deleting random files on the user’s computer as it could cause major problems. You could take the snapchat approach and just send notifications to the proctor when files are created during a test. Thanks, Jon On Feb 22, 2014, at 1:54 PM, Matt Gough wrote: > OK, > >

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Jonathan Hull
Ken is right about the internal representation of NSNumber not being something you can count on (as it is a class cluster). You should be able to count on the format of the data returned from its methods though (e.g. -integerValue, -floatValue). Out of curiosity, are there any constraints on t

Re: "Introducing ioscomponents.com"

2013-08-26 Thread Jonathan Hull
Good URL. The components don't really feel like they fit on iOS. Feels more like a XP UI than iOS. From your website, it seems like the components have lots of good features, but you should definitely hire a designer with iOS experience to help them feel at home on the platform... Thanks, Jo

Re: Combining pan, zoom, and rotate gestures into one?

2013-06-14 Thread Jonathan Hull
Assuming you want to rotate about the center of the object, you probably want to translate the object so it's center is at the origin, do the rotation, and then do the inverse of the translation. If you do that, the order of the recognizers shouldn't matter. Thanks, Jon On Jun 14, 2013, at 7

Re: how to draw a elliptical pie chart?

2013-06-06 Thread Jonathan Hull
If you are using a CGPath, then you will need to add the path to the CGContext and then fill the context. You would most likely want to save/restore the context around this as well. CGContextAddPath(context, path); CGContextSetFillColorWithColor(context, color); CGContextFillPath(context); If

Re: Showing a popover from an NSOutlineView

2013-05-22 Thread Jonathan Hull
Have you considered subclassing NSPopupButtonCell and overriding the interaction code? The alternative would be to subclass NSCell (or an appropriate subclass) and override the drawing methods. For the triangle, you could either use an image, or preferably, measure the dimensions and draw it

Re: Custom initWithFrame?

2013-01-03 Thread Jonathan Hull
Sure, just define initWith…. in your subclass and call super -initWithFrame: from it. Thanks, Jon On Jan 3, 2013, at 5:28 PM, Eric Dolecki wrote: > I am creating a UIView-based control that I would also like to pass in > parameters at the time of creation. Is this doable? I don't want to keep

Re: WWDC videos vs. slides?

2012-11-16 Thread Jonathan Hull
: > > On Nov 16, 2012, at 20:43 , Jonathan Hull wrote: > >> The video is an actual video (it plays at the top of the window, and can >> also be downloaded). The slides are a Keynote presentation. > > Somehow I got some kind of audio-only thing. It just shows a WWDC l

Re: WWDC videos vs. slides?

2012-11-16 Thread Jonathan Hull
The video is an actual video (it plays at the top of the window, and can also be downloaded). The slides are a Keynote presentation. Thanks, Jon On Nov 16, 2012, at 8:28 PM, Rick Mann wrote: > Hi. Does anyone know the difference between WWDC videos and slides? I can't > quite figure it out,

Re: Auto resize due to personal hotspot blue bar

2012-10-21 Thread Jonathan Hull
I think you want the FlexibleBottomMargin instead. You are defining which distance is ok to change and in this case you want the distance from the bottom of the parentView to change while keeping the top pinned in place (i.e. moving with your superview as it is resized). Thanks, Jon On Oct 2

Re: NSOperation and waitUntilFinished

2012-10-20 Thread Jonathan Hull
You probably want to be using -addDependency: -waitUntilAllOperationsAreFinished just blocks the thread it is called on until the receiver finishes (thus if you call it on the same thread as the queue, it will block it forever). If you need to do something after the operation is done which is n

Re: Constraints Question

2012-09-29 Thread Jonathan Hull
You probably want to set the content hugging priority of the button to a lower value (probably UILayoutPriorityDefaultLow). By default, buttons have an intrinsic constraint that says they don't like to grow vertically (it likes to "hug" its content strongly in the vertical direction). [myButto

Re: Accessing array in thread safe way

2012-03-07 Thread Jonathan Hull
I believe that reading is thread safe, but writing is not. You could wrap all access to the array in methods which use the same GCD queue to read/write, and that would be thread safe. Thanks, Jon On Mar 6, 2012, at 11:51 AM, Jan E. Schotsman wrote: > Hello, > > I have an array of progress v

Re: copy & isEqual nightmares

2012-02-15 Thread Jonathan Hull
This reminded me of this blog post, which you may find interesting: http://ridiculousfish.com/blog/posts/array.html Thanks, Jon On Feb 14, 2012, at 8:35 AM, Quincey Morris wrote: > NSDictionary may not use the value object hashes, but I don't see that > there's anything from preventing it from