Re: UiView as slider with inertia

2018-10-01 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 sliders that are really 
> sequential numbers with the selected value in the middle of the screen. They 
> want drag and release with inertia and also rubber banding on the ends. 
> Values snap into place. 0 1 2 3 4 5 ...
> 
> Does anyone have something like this to save me some time? I'm assuming 
> uipangesturerecognizer and some uikit dynamics.
> 
> Thanks!!
> Eric
> 
> Sent from my iPhone X.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 the same error.

Where are we supposed to create our package?  Does the browser copy it to a 
specific place? or do we need to copy it?

Here is the error:
[ERROR] Could not get attribute values for item file:. Error: 
Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not 
permitted to access the URL."

Thanks,
Jon


> On Jun 21, 2017, at 5:41 AM, davel...@mac.com wrote:
> 
>> 
>> On Jun 20, 2017, at 5:29 PM, Kyle Sluder  wrote:
>> 
>> On Tue, Jun 20, 2017, at 03:40 PM, davel...@mac.com wrote:
>>> I'm trying out the new UIDocumentBrowserViewController in iOS 11 (using
>>> the iPad simulator). I can get it to create a new document (which is a
>>> file package) for my app, but tapping on the document in the
>>> UIDocumentBrowserViewController does not cause the delegate method
>>> documentBrowser(_ controller: UIDocumentBrowserViewController,
>>> didPickDocumentURLs documentURLs: [URL]) to get called.
>>> 
>>> It does get called for another document type that is a flat file (not a
>>> file package), but it doesn't work with the file package document created
>>> by NSFileWrapper.
>>> 
>>> Am I doing something wrong or is this a bug with file packages?
>> 
>> Please file a bug report and send me the number so I can ensure the
>> correct team sees it.
>> 
>> Thanks,
>> --Kyle
>> 
>>> 
>>> Thanks,
>>> Dave
> 
> I have one more idea to try and then if that doesn't work, I'll try to make a 
> small sample project today and submit the bug report (and I'll email you the 
> #).
> 
> The one thing I'm not certain about is the WWDC video shows making an empty 
> file and adding it to the project as a resource and then copying it when the 
> new document button is pressed. Do I just need to make an empty directory for 
> that? My idea was to create an empty document with my app (in the simulator) 
> and then copy that empty document directory to the Xcode project. Are there 
> any special flags/attributes that need to be set on that directory to make it 
> a correct package?
> 
> Thanks,
> Dave Reed
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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:
 
> On Mar 29, 2017, at 6:57 AM, Daryle Walker    >> wrote:
> 
> Now the new Xcode release notes say that “• Swift now warns when an 
> NSObject subclass attempts to override the initialize class method, 
> because Swift can't guarantee that the Objective-C method will be called. 
> (28954946)”
 
 Huh, I haven’t heard of that. And I’m confused by “the Objective-C method” 
 — what’s that? Not the +initialize method being compiled, because that’s 
 in Swift. The superclass method?
 
 Guess I’ll follow that Radar link and read the bug report myself. Oh, 
 wait. :(
>>> 
>>> You actually can this time, since Swift’s bug reporter is actually open to 
>>> the public. https://bugs.swift.org/browse/SR-3114 
>>> >>  >
>>> 
>>> Basically, with Whole Module Optimization turned on, +initialize wasn’t 
>>> getting called. Their solution was to just get rid of +initialize.
>> 
>> You don't even need WMO. Many arrangements of Swift code can bypass ObjC 
>> +initialize.
>> 
>> Invocation of +initialize is a feature of objc_msgSend(). Swift code does 
>> not always use objc_msgSend() when calling methods: some methods are 
>> inlined, some are called via virtual table, some are called directly. None 
>> of these paths will provoke +initialize. 
>> 
>> Changing Swift's generated code to guarantee +initialize would be 
>> prohibitively expensive. Imagine an is-initialized check in front of every 
>> inlined call. It would be more expensive than +initialize in ObjC because 
>> +initialize checking is free once you pay the cost of objc_msgSend(). (The 
>> ObjC runtime checks +initialize on uncached dispatch, and never caches 
>> anything until +initialize completes. Most dispatches are cached so they pay 
>> nothing for +initialize support.)
>> 
>> +initialize in Swift isn't safe and is too expensive to make safe, so we're 
>> taking it away instead.
> 
> I wonder if an equivalent Swift-native feature could be added, something like 
> a typeInit block? If the block weren’t there, nothing special would happen, 
> and if the block were present, the compiler could basically generate the code 
> in the example I gave, but add the static var access to the front of every 
> initializer and static/class member. That shouldn’t impact performance too 
> much, and wouldn’t impact at all in the case that there’s no type initializer.

I hope so as well.  My favorite candidate so far would be a reflection 
capability to get a list of all classes/structs/enums adhering to a protocol.  
Then you could build your own initializable protocol fairly easily (and can 
even build whatever facility you want to guarantee a particular ordering or 
timing). The reason, I favor it over a specific method, is that it also enables 
a bunch of other cool patterns like extensible factories, and easy plug-ins.





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 person in my 
mind :-)

Thanks,
Jon

> On Jan 25, 2017, at 3:38 PM, Greg Parker  wrote:
> 
> What Are You Trying To Do™ is in fact precisely the correct response to your 
> question. Some overrides of -release need to call [super release]. Others do 
> not. It depends on … what they are trying to do.
> 
> Overriding release to unregister an observer is almost certainly a bad idea, 
> but yes, such an override ought to call [super release] if the object is 
> expected to be retained and released and deallocated normally. 
> 
> 
> -- 
> Greg Parker gpar...@apple.com  Runtime 
> Wrangler
> 
> 
>> On Jan 25, 2017, at 8:23 AM, Dave  wrote:
>> 
>> I hate it when people as that question! There are some memory leaks in a 3rd 
>> party package. It overrides release to unregister an observer but doesn’t 
>> call super. If I call super the leaks go away and all is well. I just want 
>> to know where is it documented really, I can’t find it searching the docs.
>> 
>> Cheers
>> Dave
>> 
>>> On 25 Jan 2017, at 15:55, Mike Abdullah  wrote:
>>> 
>>> You’re inevitably going to get asked this:
>>> Why on earth are you overriding release? It’s an incredibly niche thing to 
>>> do, and the answer probably depends a lot on why you’re overriding it.
>>> 
 On 25 Jan 2017, at 16:52, Dave  wrote:
 
 Hi,
 
 Does [suoer release] need to be called if you override this method? I’m 
 99.9% sure it does, but I can’t find it anywhere it actually says it 
 in black and white.
 
 All the Best
 Dave
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 Hull <jh...@gbis.com> wrote:
> 
> 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, at 5:33 PM, Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote:
>> 
>> var numbers: [UInt64] = …
>> 
>> func numbers( upTo nbr: Int ) -> [UInt64] 
>> {
>>  let slice = numbers[ 0 ..< nbr ] 
>>  return slice
>>  //  Cannot convert return expression of type ‘ArraySlice' 
>> to return type '[UInt64]' 
>> 
>>  //  workaound:
>>  var outCopy:[UInt64] = []
>>  for i in 0 ..< nbr { outCopy.append( numbers[i] ) }
>>  return outCopy
>> }
>> 
>> Any better way to do this?
>> 
>> Gerriet.
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>> 
>> This email sent to jh...@gbis.com
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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, at 5:33 PM, Gerriet M. Denkmann  wrote:
> 
> var numbers: [UInt64] = …
> 
> func numbers( upTo nbr: Int ) -> [UInt64]  
> {
>   let slice = numbers[ 0 ..< nbr ] 
>   return slice
>   //  Cannot convert return expression of type ‘ArraySlice' 
> to return type '[UInt64]' 
> 
>   //  workaound:
>   var outCopy:[UInt64] = []
>   for i in 0 ..< nbr { outCopy.append( numbers[i] ) }
>   return outCopy
> }
> 
> Any better way to do this?
> 
> Gerriet.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Dynamic-width Collection View

2016-08-10 Thread Jonathan Hull
The main issue is that the cell doesn’t (and shouldn’t) have any idea about 
what size the collectionView is.  You could actually use the delegate though 
(which has a wider view) and provide the size that way.

That said, I did additional research and found other people with your issue.  
Relevant posts:
https://github.com/imyoungyang/DynamicHeight

http://stackoverflow.com/questions/25895311/uicollectionview-self-sizing-cells-with-auto-layout

My recommendation would be to remove the preferredAttributes stuff, and give 
your cell’s content view an explicit width constraint. Then in the 
collectionView:layout:sizeForItemAtIndexPath: method of your 
FlowLayoutDelegate, set the constant of the width constraint to the desired 
width (you are passed the collectionView). Then return the result of 
contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).  Note: 
I haven’t actually tried this… all code written in mail.

Thanks,
Jon

> On Aug 10, 2016, at 2:27 PM, Doug Hill <cocoa...@breaqz.com> wrote:
> 
> Jonathon,
> 
> Thanks for the feedback.
> 
> A question that comes to mind is, what about making cells the same size as 
> the collection view requires going through subclassing the collection view 
> layout? Apple documentation IMPLIES this should work. It even documents that 
> developers should use preferredLayoutAttributesFittingAttributes for this 
> very purpose.
> 
> The reason I don't want to subclass flow layout is that I pretty much want 
> the exact functionality the default flow layout provides:
> 
> 1. Automatically calculating layout rects that flow across lines.
> 2. Calculating the height of cells dynamically at runtime via 
> 'estimatedItemSize'
> 
> Given that, I'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 <jh...@gbis.com 
>> <mailto:jh...@gbis.com>> wrote:
>> 
>> Because you are trying to make the width of the cell the same size as the 
>> collection view, I would strongly consider writing a small subclass of flow 
>> layout.  It honestly sounds like less work than what you are dealing with 
>> now.
>> 
>> Thanks,
>> Jon
>>  
>>> On Aug 10, 2016, at 1:29 PM, Doug Hill <cocoa...@breaqz.com 
>>> <mailto:cocoa...@breaqz.com>> wrote:
>>> 
>>>> 
>>>> On Aug 10, 2016, at 11:10 AM, Doug Hill <cocoa...@breaqz.com 
>>>> <mailto:cocoa...@breaqz.com>> wrote:
>>>> 
>>>> I'm currently trying to implement something that seems basic but has been 
>>>> driving me nuts: making a Collection View with cells that are 
>>>> dynamic-width and height at runtime.
>>>> 
>>> 
>>> Again, looking for any ideas, pointers, etc. about any of this, including 
>>> whether I'm going about this the wrong way.
>>> 
>>> Doug Hill
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simplest way to generate audio tones?

2016-05-29 Thread Jonathan Hull
Here it is for iOS (I assume that this is low-level enough that it is almost 
the same cross-platform):
https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html#//apple_ref/doc/uid/TP40009767-CH2-SW6

My first thought would be to either create a buffer (as you say) or file with 
the sound you want, and then play that…

Thanks,
Jon

> On May 28, 2016, at 10:44 PM, Graham Cox <graham@bigpond.com> wrote:
> 
> Probably should have mentioned this is Mac, not iOS.
> 
> Yes, there are Audio Units, but they’re not really what I’m after. You can’t 
> simply create a generator audio unit and use it in an app to generate tones 
> (as far as I’m aware) - it has to be part of the whole Core Audio signal 
> chain. I’m looking for a much higher level approach if possible. I’m thinking 
> perhaps AVAudioPlayer might be suitable, as it has an init method that takes 
> an NSData object that is a sound buffer. I can definitely make one filled 
> with sine values, but as usual the documentation lets me down - it states 
> that the buffer must be formatted according to the supported formats listed 
> in "Multimedia 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 <jh...@gbis.com> wrote:
>> 
>> 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 <graham@bigpond.com> wrote:
>>> 
>>> Hi all,
>>> 
>>> I’m looking for general pointers to the simplest/quickest way to generate 
>>> an audio tone (sine wave) of a given frequency and duration. Most of the 
>>> audio APIs seem concerned with playing samples rather than generating 
>>> tones, so it’s not immediately obvious where to look.
>>> 
>>> —Graham
> 
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 to generate an 
> audio tone (sine wave) of a given frequency and duration. Most of the audio 
> APIs seem concerned with playing samples rather than generating tones, so 
> it’s not immediately obvious where to look.
> 
> —Graham
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 imageview seems to 
> work just fine: I can scale and crop an image with no problem. But I’m having 
> difficulty getting the desired “crop circle” to hover over the scrollview 
> properly. When I add it to the main view (not the scrollview) at runtime, I 
> try using autolayout constraints to pin it to the left, top, right, and 
> bottom of the scrollview; but it always appears positioned elsewhere, as if 
> it’s not resizing due to the constraints.
> 
> I viewDidLoad(), I create each constraint like this:
> 
>   let lc = NSLayoutConstraint( overlay, attribute: .Left, relatedBy: 
> .Equal, toItem: scrollView, attribute: .Left, multiplier: 1, constant: 0 )
> 
> And when all four have been created, I call 
> NSLayoutConstraint.activateConstraints( [ lc, tc, rc, bc ] )
> 
> Is this the wrong approach? What’s the right way to display a simple overlay 
> above the content of a scrollView?
> 
> -- 
> 
> Charles
> 
> On February 21, 2016 at 20:48:18, Charles Jenkins (cejw...@gmail.com) wrote:
> 
> I’m trying to do something that’s so simple, conceptually, that I’m sure 
> there’s a demo program for it, if only I could find the right Google search 
> to locate it.
> 
> I want to allow iOS users to select an image (either from the camera roll or 
> by taking a photo) and display it in a CIRCLE for cropping. Users should be 
> able to scale and position the image as they like to fit within the circle, 
> then tap a DONE button to have the image cropped and saved into my app’s 
> image store.
> 
> I spent all day today screwing around making a view controller with a 
> scrollview containing an imageview, and I haven’t figured out how to make the 
> circle overlay correctly to fit over the scrollview.
> 
> Does anybody know of a demo program that’ll show me how to do this?
> 
> -- 
> 
> Charles
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 it possible to develop an app that can run in the background and record
> the user's device screen. For example, user can use this app to record a
> video how they play a game and post the video on the web etc.
> 
> Anyone can point me to the right direction to get it done?
> Thanks a lot.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 empty array or can I just do [[NSStackView alloc] 
> init]; ?
> 
> All the Best
> Dave
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 pickerView but the strips cause each other to 
increment when rolling past certain points  i.e. ‘0’’9’ becomes ‘1’’0’). The 
code shown here causes it to stop so that a digit is always centered after the 
user scrolls it.

The -centeredRowForOffset: method (my helper function) returns which row it 
should snap to based on the given scroll offset.  The targetContentOffset… 
methods tell the collectionView to actually snap to the offset for that row 
when animating and scrolling (respective to the order shown below).  They are 
given a proposed offset to stop at, and you return the adjusted offset that you 
would like.

Hope it helps!

func centeredRowForOffset(offset:CGFloat)->Int {
return Int(floor((offset / digitHeight) + 0.5))
}

override func 
targetContentOffsetForProposedContentOffset(proposedContentOffset: CGPoint) -> 
CGPoint {
let row = centeredRowForOffset(proposedContentOffset.y)
let target = CGFloat(row) * digitHeight

return CGPoint(x: proposedContentOffset.x, y: target)
}

override func 
targetContentOffsetForProposedContentOffset(proposedContentOffset: CGPoint, 
withScrollingVelocity velocity: CGPoint) -> CGPoint {
let row = centeredRowForOffset(proposedContentOffset.y)
let target = CGFloat(row) * digitHeight

return CGPoint(x: proposedContentOffset.x, y: target)
}

Thanks,
Jon 


> On Dec 2, 2015, at 6:16 PM, Eric Dolecki  wrote:
> 
> Do you have any sample code for such a thing?
> 
> Sent from Outlook 
> 
> 
> 
> On Wed, Dec 2, 2015 at 6:15 PM -0800, "Jon Hull"  > wrote:
> 
> Hi Eric,
> 
> When creating similar controls in the past (I am actually making an odometer 
> style view right now), I have found that collection views work really well. 
> There is a delegate call (something like proposedOffset:forTargetOffset:) 
> which gives you the sticky behavior you desire...
> 
> Thanks,
> Jon
> 
> Sent from my iPhone
> 
> > On Dec 2, 2015, at 4:22 PM, Eric Dolecki  wrote:
> > 
> > I need to create a time picker control but don't have much vertical room. 
> > So buttons above and below to affect hours, min, am/pm are out. I was 
> > thinking swipes up and down. Best to use 3 UIScrollviews? Inertia is there. 
> > Only thing is how to get the numbers to "stick" in selection position while 
> > still allowing for smooth scrolling with quick flicking. Technique for that?
> > Is this a good solution? Anything I might consider?
> > ___
> > 
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> > 
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> > 
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> > 
> > This email sent to jh...@gbis.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 AM, Michael de Haan   wrote:
> 
> I am calling this function,
> 
> 
> func createMOforEntityName(entityName:String, 
> context:NSManagedObjectContext, key:String, keyAttribute: U) -> (Bool, T) {
> 
>guard let mo:T =  self.moExistsWith(entityName, key:key, keyAttribute: 
> keyAttribute) else {
> 
>let mo:T = 
> NSEntityDescription.insertNewObjectForEntityForName(entityName, 
> inManagedObjectContext: context) as! T
> 
>return (false, mo)
> 
>}
> 
>return (true, mo)
>}
> 
> 
> with this call:
> 
> let (already_Exists, aNewMO:ESLSizeMO) = 
> createMOforEntityName("ESLSizeEntity", context: self.managedObjectContext, 
> key:"sizeName", keyAttribute: sizeName)
> 
> 
> 
> In this case, sizeName is a String, but key attribute could also be a Double. 
>  The Error is on the calling line:
> 
> Cannot invoke 'createMOforEntityName' with an argument list of type '(String, 
> context: NSManagedObjectContext, key: String, keyAttribute: String)'
> 
> The hint says: 'Expected an argument list of type '(String, context: 
> NSManagedObjectContext, key: String, keyAttribute: U)’
> 
> My question is how to call “createMOforEntityName” when  ‘U’ could either be 
> a String, or a Double.
> 
> Thanks in advance.
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 optimized for data 
transfer) or bluetooth.

The Apple watch pairing process does seem to use the camera and a moving 
pattern (not frequency of flash, but a pattern of dots on the screen)

Thanks,
Jon

> On Sep 16, 2015, at 8:14 PM, ico  wrote:
> 
> First of all, please take a look at this video:
> https://www.youtube.com/watch?v=LPyLHhiGTHM
> 
> This toy can connect to the iphone's network by detecting the blinking
> screen of an iPhone. I wonder if it is possible that using this technique
> to transfer data.
> For instance,
> 1. you have some data, and transform it into a frequency of flash light
> 2. you control iPhone A to blink its screen or its flashlight according to
> this frequency
> 3. you control iPhone B to detect this frequency of light
> 4. you transform this message into some data which is the same as you have
> in the 1st step
> 
> Anyone can give a hint about achieving this?
> Sorry for my bad English.
> 
> Thank you!
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
It looks like these are the constraints inside of the detailView (that hold 
it’s sub-parts together).  Doesn’t really tell us anything about the 
constraints holding the detailView itself in place...

Thanks,
Jon


> On Sep 14, 2015, at 12:21 PM, Dave <d...@looktowindward.com> wrote:
> 
> These are the constraints on the detail view just after it has been added to 
> the StackView:
> 
> myDetailView.constraints: (
>" DetailHeaderView:0x631809c0, LTWDetailXView:0x6318, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" DetailBodyView.trailing   (Names: DetailHeaderView:0x631809c0, 
> DetailBodyView:0x621805b0 )>”,
> 
>" DetailBodyView.leading   (Names: DetailHeaderView:0x631809c0, 
> DetailBodyView:0x621805b0 )>”,
> 
>" DetailHeaderView:0x631809c0, LTWDetailXView:0x6318, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" LTWDetailXView:0x6318, DetailHeaderView:0x631809c0, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" LTWDetailXView:0x6318, DetailBodyView:0x621805b0, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" V:[DetailHeaderView]-(-2)-[DetailBodyView]   (Names: 
> DetailBodyView:0x6200001805b0, DetailHeaderView:0x631809c0 )>"
> )
> 
> Which look ok me me?
> 
> Cheers
> Dave
> 
>> On 14 Sep 2015, at 19:18, Jonathan Hull <jh...@gbis.com> wrote:
>> 
>> Oh yeah, it does on iOS, but not OS X.  Sorry about that.
>> 
>> On OS X, you need to layer back it and set the layer’s background color.
>> 
>> stackview.wantsLayer = YES
>> stackview.layer.backgroundColor = [NSColor blueColor]
>> 
>> (Note: The above was written in mail, so it may take a little tweaking to 
>> work)
>> 
>> Thanks,
>> Jon
>> 
>>> On Sep 14, 2015, at 11:11 AM, Dave <d...@looktowindward.com> wrote:
>>> 
>>> 
>>>> On 14 Sep 2015, at 18:50, Jonathan Hull <jh...@gbis.com> 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), 
>>>> 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 test this by temporarily removing the detail view (and associated 
>>>> constraints) and setting the StackView’s background color to some bright 
>>>> color.
>>> 
>>> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. 
>>> I set it on the ScrollView, that that of course moves when I resize the 
>>> window.
>>> 
>>> These are the frame rects after adding the DetailView to the StackView.
>>> 
>>> ScrollView Frame: {{20, 54}, {760, 355}}
>>> ClipView Frame: {{1, 1}, {743, 353}}
>>> StackView Frame: {{0, 0}, {744, 16}}
>>> ???
>>> 
>>> I can add as many views as I like to the StackView and it’s Scrolls 
>>> correctly vertically, I just can’t get the Detail View to expand out in H. 
>>> Yes,
>>> 
>>>> Constraints with ScrollViews are notoriously tricky…
>>> 
>>> You’re not wrong there!
>>> 
>>> Incidentally, I took another look at InfoBarView and it doesn’t handle 
>>> window re-sizing so it’s not much good in this case.
>>> 
>>> Thanks a lot.
>>> Cheers
>>> Dave
>>> 
>>> 
>>>>> On Sep 14, 2015, at 8:48 AM, Dave <d...@looktowindward.com> wrote:
>>>>> 
>>>>> 
>>>>>> 
>>>>>> In fact, with NSStackView you should just be able to set the content 
>>>>>> hugging priority and it’ll just work
>>>>>> 
>>>>>> myDetailView = [myDetailViewController getPrimaryView];
>>>>>> [self.pValidationListStackView addView:myDetailView 
>>>>>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
>>>>>> GravityLeading as you’re using a horizontal stack view?
>>>>>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>>>>>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>>>>>> 
>>>>>> and that’s all you should need.
>>>>>> 
>>>>>> iain
>>>>> 
>>>>> I tried that and it had n

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 <d...@looktowindward.com> wrote:
> 
> 
>> On 14 Sep 2015, at 18:50, Jonathan Hull <jh...@gbis.com> 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), 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 
>> test this by temporarily removing the detail view (and associated 
>> constraints) and setting the StackView’s background color to some bright 
>> color.
> 
> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. I 
> set it on the ScrollView, that that of course moves when I resize the window.
> 
> These are the frame rects after adding the DetailView to the StackView.
> 
> ScrollView Frame: {{20, 54}, {760, 355}}
> ClipView Frame: {{1, 1}, {743, 353}}
> StackView Frame: {{0, 0}, {744, 16}}  
> ???
> 
> I can add as many views as I like to the StackView and it’s Scrolls correctly 
> vertically, I just can’t get the Detail View to expand out in H. Yes,
> 
>> Constraints with ScrollViews are notoriously tricky…
> 
> You’re not wrong there!
> 
> Incidentally, I took another look at InfoBarView and it doesn’t handle window 
> re-sizing so it’s not much good in this case.
> 
> Thanks a lot.
> Cheers
> Dave
> 
> 
>>> On Sep 14, 2015, at 8:48 AM, Dave <d...@looktowindward.com> wrote:
>>> 
>>> 
>>>> 
>>>> In fact, with NSStackView you should just be able to set the content 
>>>> hugging priority and it’ll just work
>>>> 
>>>> myDetailView = [myDetailViewController getPrimaryView];
>>>> [self.pValidationListStackView addView:myDetailView 
>>>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
>>>> GravityLeading as you’re using a horizontal stack view?
>>>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>>>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>>>> 
>>>> and that’s all you should need.
>>>> 
>>>> iain
>>> 
>>> I tried that and it had no effect. When I resize the window the Scroll View 
>>> Resizes (and I assume the StackView?) but the Detail View stays the same 
>>> size - e.g. does not move with the right edge of the Scroll View.
>>> 
>>> Cheers
>>> Dave
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>>> 
>>> This email sent to jh...@gbis.com
>> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
Oh yeah, it does on iOS, but not OS X.  Sorry about that.

On OS X, you need to layer back it and set the layer’s background color.

stackview.wantsLayer = YES
stackview.layer.backgroundColor = [NSColor blueColor]

(Note: The above was written in mail, so it may take a little tweaking to work)

Thanks,
Jon

> On Sep 14, 2015, at 11:11 AM, Dave <d...@looktowindward.com> wrote:
> 
> 
>> On 14 Sep 2015, at 18:50, Jonathan Hull <jh...@gbis.com> 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), 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 
>> test this by temporarily removing the detail view (and associated 
>> constraints) and setting the StackView’s background color to some bright 
>> color.
> 
> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. I 
> set it on the ScrollView, that that of course moves when I resize the window.
> 
> These are the frame rects after adding the DetailView to the StackView.
> 
> ScrollView Frame: {{20, 54}, {760, 355}}
> ClipView Frame: {{1, 1}, {743, 353}}
> StackView Frame: {{0, 0}, {744, 16}}  
> ???
> 
> I can add as many views as I like to the StackView and it’s Scrolls correctly 
> vertically, I just can’t get the Detail View to expand out in H. Yes,
> 
>> Constraints with ScrollViews are notoriously tricky…
> 
> You’re not wrong there!
> 
> Incidentally, I took another look at InfoBarView and it doesn’t handle window 
> re-sizing so it’s not much good in this case.
> 
> Thanks a lot.
> Cheers
> Dave
> 
> 
>>> On Sep 14, 2015, at 8:48 AM, Dave <d...@looktowindward.com> wrote:
>>> 
>>> 
>>>> 
>>>> In fact, with NSStackView you should just be able to set the content 
>>>> hugging priority and it’ll just work
>>>> 
>>>> myDetailView = [myDetailViewController getPrimaryView];
>>>> [self.pValidationListStackView addView:myDetailView 
>>>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
>>>> GravityLeading as you’re using a horizontal stack view?
>>>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>>>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>>>> 
>>>> and that’s all you should need.
>>>> 
>>>> iain
>>> 
>>> I tried that and it had no effect. When I resize the window the Scroll View 
>>> Resizes (and I assume the StackView?) but the Detail View stays the same 
>>> size - e.g. does not move with the right edge of the Scroll View.
>>> 
>>> Cheers
>>> Dave
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>>> 
>>> This email sent to jh...@gbis.com
>> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 
test this by temporarily removing the detail view (and associated constraints) 
and setting the StackView’s background color to some bright color.

Constraints with ScrollViews are notoriously tricky…

Thanks,
Jon


> On Sep 14, 2015, at 8:48 AM, Dave  wrote:
> 
> 
>> 
>> In fact, with NSStackView you should just be able to set the content hugging 
>> priority and it’ll just work
>> 
>> myDetailView = [myDetailViewController getPrimaryView];
>> [self.pValidationListStackView addView:myDetailView 
>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be GravityLeading 
>> as you’re using a horizontal stack view?
>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>> 
>> and that’s all you should need.
>> 
>> iain
> 
> I tried that and it had no effect. When I resize the window the Scroll View 
> Resizes (and I assume the StackView?) but the Detail View stays the same size 
> - e.g. does not move with the right edge of the Scroll View.
> 
> Cheers
> Dave
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 noise:String {get}
}

protocol MyProtocol {
func returnAThing()->Thing
}

class SquishyThing:Thing {
var noise:String {return “Squish”}
var squishiness:Int = 3
}

class PoppingThing:Thing {
var noise:String {return “Pop”}
var poppability:Float = 4.2 
}

class SquishyVendor:MyProtocol {
func returnAThing()-> SquishyThing {return SquishyThing()}
}

class PoppingVendor:MyProtocol {
func returnAThing()-> PoppingThing {return PoppingThing()}
}


This would allow you to say things like:

mySquishyVendor.returnAThing.squishiness = 6
myPoppingVendor.returnAThing.poppability = 2.8

instead of:

(mySquishyVendor.returnAThing as! SquishyThing).squishiness = 6
(myPoppingVendor.returnAThing as! PoppingThing).poppability = 2.8


Is there an obvious problem caused by this which I am missing?  I can think of 
3 or 4 places where it would shrink my code quite a bit.

Thanks,
Jon



> On Sep 6, 2015, at 1:50 PM, Charles Srstka  wrote:
> 
>> On Sep 6, 2015, at 3:19 PM, Quincey Morris 
>>  wrote:
>> 
>> (But merely defining a protocol for each of your subclasses is not an 
>> improvement here.)
> 
> It does, however, seem to avoid the crash:
> 
> class ObjectBase {
>   required init() {}
> }
> 
> protocol MyProtocol {
>   func foo()
>   func bar()
>   func baz()
> }
> 
> class MyObject: ObjectBase, MyProtocol {
>   func foo() { print("foo") }
>   func bar() { print("bar") }
>   func baz() { print("baz") }
>   
>   required init() {}
> }
> 
> let obj = MyObject()
> 
> compiles and runs without errors.
> 
> Charles
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 representing “pickable” colors are shown to 
allow the user to match the color of other objects on the screen.  I need the 
popover’s frame so I can move any of these views which would be covered by the 
popover to a location where the user can see them.

Any help is appreciated.  Let me know if I need to clarify anything about the 
question or provide additional details…

Thanks,
Jon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 
 devarshi.bluec...@gmail.com wrote:
 
 In iOS 8, Apple has a new feature in Safari that allows users to scan a
 credit card with the device’s camera rather than manually entering the
 number when making a purchase online.
 
 Does it also expose native APIs for the same to be used by developer
 community as well? Any ideas?
 
 -- 
 Thanks,
 
 Devarshi
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 rm...@latencyzero.com 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/blob/master/Common/HttpServer.swift
 
 I can write in-line handlers for this, but I'm trying to write a separate 
 method, and just assign the method as a handler, and I can't seem to get the 
 signature right. Is it the same as this?
 
   func myHandler(req : HttpRequest) - HttpResponse
 
 
 Thanks.
 
 -- 
 Rick Mann
 rm...@latencyzero.com
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 everything can be transformed into (i.e toIntMax() ).  You could mimic 
this by turning everything into a double (or an NSDecimalNumber if you care 
more about precision than speed) for cases where the type doesn’t match.

Someone else may have a more elegant answer...

Thanks,
Jon


 On Jun 24, 2015, at 12:19 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I've been experimenting with Swift 2, and have started writing a generic 
 Vector3T class. It looks something like this:
 
 -
 protocol
 VectorElementType: IntegerLiteralConvertible
 {
   func +(a: Self, b: Self) - Self
 }
 
 struct
 Vector3T where T: VectorElementType
 {
   init()
   {
   x = 0;
   y = 0;
   z = 0;
   }
   
   init(_ inX: T, _ inY: T, _ inZ: T)
   {
   x = inX
   y = inY
   z = inZ
   }
   
   var x: T
   var y: T
   var z: T
 }
 
 func
 +T(inLeft: Vector3T, inRight: Vector3T)
   - Vector3T
 {
   return Vector3T(inLeft.x + inRight.x, inLeft.y + inRight.y, inLeft.z 
 + inRight.z)
 }
 
 
 extension Float: VectorElementType {}
 extension Double: VectorElementType {}
 
 typealias Vector3f = Vector3Float
 typealias Vector3d = Vector3Double
 -
 
 The thing I'd like to do is let the + operator support two different types of 
 Vector3, such that if the individual VectorElementTypes are addable together 
 (either because a + operator exists for both types, or because one type can 
 be promoted to a type that can add), then it all just works.
 
 In C++, this works because template instantiation happens when the types are 
 introduced, but in Swift, I have to promise that the types will work out that 
 way. But I've not figured out how.
 
 E.g., I can't do this:
 
 var a = Vector3d(1, 2, 3)
 var b = Vector3f(4, 5, 6)
 
 var c = a + b
 
 How might I accomplish this? Thanks!
 
 
 -- 
 Rick Mann
 rm...@latencyzero.com
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 newsli...@autonomy.caltech.edu 
 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 that was hidden deep in Apple’s source code?  
Swift is designed to stop things like that from happening.  From the tone of 
all of the Swift talks, it seems that Safety and preventing exploitable bugs 
are the main point of Swift.  There are others, of course (e.g. increased 
optimization/speed), but that seems to be the primary one that Apple is 
concerned with.

Thanks,
Jon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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  indexPath.length ; i++) {
path = [path indexPathByAddingIndex:[indexPath indexAtPosition:i]];
}
return path;
}

- (NSIndexPath *)indexPathByAddingIndexInFront:(NSUInteger)index {
NSIndexPath* indexPath = [NSIndexPath indexPathWithIndex:index];
return [indexPath indexPathByAddingIndexPath:self];
}

Thanks,
Jon

 On Jun 1, 2015, at 11:06 AM, Dave d...@looktowindward.com wrote:
 
 Hi All,
 
 I’ve got an Index Path, that needs to have an extra level added to it at the 
 beginning.
 
 e.g.
 
 0.1.2.3.4
 
 Needs to be:
 
 0.0.1.2.3.4
 
 Is there are easy way to do this that doesn’t involve playing with NSUInteger 
 Arrays?
 
 If not I think I’ll write a category method that does it, any tips greatly 
 appreciated.
 
 All the Best
 Dave
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 which you 
can apply constraints against and then add your contents to that view.

In this case you would add an inequality constraint between that view in the 
scrollView and the window’s main view (i.e. the window width must be 
less-than-or-equal to the scrollView’s content plus some constant). You might 
need to write that programmatically (as opposed to in IB).

(Note: This is off the top of my head, haven’t gotten a chance to test it)

Thanks,
Jon


 On May 24, 2015, at 10:00 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I have a bunch of views statically arranged inside an NSScrollView. Their 
 relative size doesn't change. But it's a large view, and I want to be able to 
 view it on smaller displays, hence the scroll view.
 
 Is there a way to constrain the window size to never be larger than just big 
 enough to disable to scroll bars using autolayout constraints?
 
 -- 
 Rick Mann
 rm...@latencyzero.com
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 my attempt:

let player = MPMoviePlayerController(contentURL: videoURL)
player.prepareToPlay()
player.view.frame = frame //This is defined above as the 
stillFrame’s frame
self.view.addSubview(player.view)
player.setFullscreen(true, animated: true)
player.play()

This does the zoom, but the video just shows “Loading…” indefinitely.  I know 
that the video url is correct and that the video can play because this code 
works (it just doesn’t do the zoom):

let player = MPMoviePlayerViewController(contentURL: videoURL)
player.moviePlayer.prepareToPlay()
player.moviePlayer.play()
self.presentMoviePlayerViewControllerAnimated(player)

Any idea what is going on here?  Am I missing something simple in the first 
example?

Thanks,
Jon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Tracking the retain count

2015-05-20 Thread Jonathan Hull

 On May 19, 2015, at 8:04 PM, Quincey Morris 
 quinceymor...@rivergatesoftware.com 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 
objects have already been marked as purgeable?  What if a new object is added 
to the cache just after the cache has been asked to purge due to low memory, 
but before the autorelease pool has drained?

It seems like you would still need to track which objects have been retained on 
a per-object basis to avoid shooting yourself in the foot.  Having a collection 
with strong references to cached objects just provides this implicitly (and in 
a very future-proof way), but there are other ways (e.g. bitfields) which might 
save space if required.

I still like Roland’s suggestion the best:  A NSMapTable with strong keys and 
weak values combined with an array/set with strong references to keep things 
around (which gets purged in low memory situations).  If you are worried about 
the extra space, limit the cache to the 100 most recent objects (or some other 
number determined by testing).  That memory will be reclaimed in low-memory 
situations anyway.

Thanks,
Jon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 situation) which 
just empties the array.

2) Instead of having a central object pool, have the objects adhere to a 
protocol which takes a method to be called in low-memory situations which nils 
out things which can be reconstructed later and then calls the same method on 
objects lower in the graph.

Thanks,
Jon

 On May 17, 2015, at 5:47 PM, Britt Durbrow 
 bdurb...@rattlesnakehillsoftworks.com wrote:
 
 Ughh… I find myself in a bit of a quandary:
 
 I have a pool of disk-backed (well, flash-backed on iOS) objects that have an 
 arbitrary graph structure. These are managed by a central object pool. The 
 object pool is supposed to cache these in memory (creating them is somewhat 
 non-trivial), and hold onto ones that it’s been told to even if there are no 
 other objects that currently have an active pointer to them outside of the 
 pool’s object graph (consequently, just using weak links won’t work for my 
 problem).
 
 In order to respond to iOS memory pressure warnings, I need to have the 
 object pool de-construct and release any graph segments that are not 
 currently being used outside of the object pool. However, this needs to 
 happen only during a memory pressure event, and not otherwise.
 
 The only thing I’ve been able to come up with so far is somehow tracking the 
 retain count state of the objects in the object pool, and when a memory 
 pressure event occurs having the object pool find all the objects that are 
 only in use in the graph and held by itself, and release them. Once all the 
 otherwise unused objects have been converted via an isa swizzle to faults 
 (and thusly no longer contain retain cycles), the faulted objects that are 
 candidates for release should have a retain count of 1… at which point I can 
 have the pool remove them from it’s main NSMutableDictionary (which will now 
 cause them to be deallocated).
 
 This, however, is kinda ugly… and known to be prone to pitfalls... but is 
 there any better way?
 
 Note that I don’t want to just use CoreData. Also, I did think of having the 
 objects in the graph that are supposed to be held on to be held in a strong 
 container, and the objects not currently being held on to in a weak 
 container, but that doesn’t work because then the objects in the weak 
 container will get purged when immediately, not just under a memory pressure 
 event.
 
 
 So what I’m looking at now is creating an intermediate base class for all of 
 these objects, that is compiled with ARC turned off, and provides access to 
 retainCount. Yes, I know that it doesn’t reflect any autoreleases that have 
 occurred on the object. This is OK as far as I know - for this specific use, 
 if something has an outstanding autorelease on an object, it’s probably OK to 
 keep it around, as long as enough of the cached objects get purged to satisfy 
 the memory pressure event. Also, this object pool is not guaranteed to be 
 thread-safe so I don’t think that the potential race conditions of 
 retain/release/autorelease/retainCount interaction will come into play.
 
 
 Any ideas? Comments? Rotten tomatoes? :-)
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 graham@bigpond.com wrote:
 
 
 On 18 May 2015, at 11:14 am, Jonathan Hull jh...@gbis.com wrote:
 
 Instead of having a central object pool, have the objects adhere to a 
 protocol which takes a method to be called in low-memory situations
 
 
 Yep. You could call it ‘NSDiscardableContent’ ;)
 
 —Graham
 
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Stupid ! and ?

2015-04-25 Thread Jonathan Hull

 On Apr 25, 2015, at 7:59 AM, William Squires wsqui...@satx.rr.com wrote:
 
 Where I'm running into problems is this line of code:
 
 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: 
 NSIndexPath) - UITableViewCell
 {
 var cell = tableView.dequeueReusableCellWithIdentifier(simpleTableIdentifier) 
 as? UITableViewCell
 if (cell == nil)
  {
  cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: 
 simpleTableIdentifier)
  }
 cell!.textlabel.text = dwarves[indexPath.row] // Problem here
 return cell
 }
 
 Xcode is complaining that a ? or ! is needed after textLabel, and 
 before the .text, but I don't really understand which one to use.

Using ‘?' here will give you the objC behavior of doing nothing if textLabel is 
nil.  Using ‘!’ would crash if it ended up as nil for some reason.  When in 
doubt use ‘?'

 Another line of code that confuses me is the first line:
 
 var cell = tableView.dequeueReusableCellWithIdentifier(simpleTableIdentifier) 
 as? UITableViewCell
 
 yet they use an ! and not a ? in the cell!.textLabel.text... line. 
 Shouldn't that be:
 
 cell?.textLabel.text to match up with the ? in the var cell... line?

The ‘!’ basically means: Hey compiler, I know you think this could be nil, but 
trust me... I promise it won’t be.  In this case, the line above it checks to 
see if cell is nil and gives it a value, so we know it isn’t nil.  I still 
prefer to use ‘?’ or ‘if let’ in these cases though.

Thanks,
Jon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 sli...@araelium.com wrote:
 
 I have a text view where I added a subview at the top, and I want all of the 
 text to be below this subview. You can think of it like having a horizontal 
 ruler above the text view, but instead I want this view (it's not a ruler) 
 _in_ the text view so that it scrolls with the text.
 
 Here are two different strategies, neither of which I can quite get to work...
 
 
 
 --
 
 The simplest thing I could think of was to subclass NSTextView and override 
 textContainerOrigin to push the Y value down a little. My little accessory 
 view then becomes a direct subview of the text view. The first line of text 
 is exactly in the right spot so it seems like it'll work perfectly, but if 
 the text fills the entire text view, it won't start scrolling until the 
 height of the *text* is greater than the height of the entire text *view*, 
 which means that however many points I've shifted the text down by, that many 
 points of text is cut off at the bottom of the text view before scrolling is 
 allowed.
 
 In other words, if the text view's could hold 10 lines of text, I shift all 
 the text down by 1 line, and put 10 lines of text into the text view, I 
 expect to see 9 lines and have to scroll to see the 10th, but instead, the 
 scrollview doesn't allow scrolling at all, so that 10th line is completely 
 inaccessible. If I add an 11th line, then I can scroll to the 10th line, but 
 not the 11th, etc.
 
 
 So whatever mechanism is calculating how much scrolling is needed, doesn't 
 respect the text container's origin as returned by NSTextView 
 -textContainerOrigin? I can't seem to figure out how to fix that.
 
 
 ---
 
 
 A completely different approach would be to affect typesetting where the line 
 fragments flow around this view, by just making sure the line fragments 
 don't start until below it. I implemented this strategy with a custom text 
 container, and it appears to work at first, but if the text is long enough 
 that scrolling is required, then the first line fragment is just at 0,0 in 
 the text container regardless of the fact that I explicitly told it to not 
 be...
 
 
 @implementation MyTextContainer
 
 - (BOOL)isSimpleRectangularTextContainer
 {
   return NO;
 }
 
 - (NSRect)lineFragmentRectForProposedRect:(NSRect)proposedRect 
 sweepDirection:(NSLineSweepDirection)sweepDirection 
 movementDirection:(NSLineMovementDirection)movementDirection 
 remainingRect:(NSRectPointer)remainingRect
 {
   if (proposedRect.origin.y + proposedRect.size.height  
 self.containerSize.height) {
   return [super lineFragmentRectForProposedRect:proposedRect 
 sweepDirection:sweepDirection movementDirection:movementDirection 
 remainingRect:remainingRect];
   }
   
   
   if (!NSIntersectsRect(NSMakeRect(0, 0, self.containerSize.width, 26), 
 proposedRect)) {
   return [super lineFragmentRectForProposedRect:proposedRect 
 sweepDirection:sweepDirection movementDirection:movementDirection 
 remainingRect:remainingRect];
   }
   
   
   NSRect reproposedRect;
   reproposedRect.origin.x = proposedRect.origin.x;
   reproposedRect.size.height = proposedRect.size.height;
   reproposedRect.size.width = self.containerSize.width;
   reproposedRect.origin.y = 26;
   reproposedRect = [self lineFragmentRectForProposedRect:reproposedRect 
 sweepDirection:sweepDirection movementDirection:movementDirection 
 remainingRect:remainingRect];
   return reproposedRect;
 }
 
 
 @end
 
 
 
 
 So there are two different strategies, and I've hit a sizable enough wall 
 that with both that I'm kinda stumped. 
 
 Anyone had any luck doing something like this?
 
 
 
 --
 Seth Willits
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 
 patr...@collinatorstudios.com wrote:
 
 I am trying to create a playhead that will move across a waveform, and
 IB shows a Vertical line component which looks exactly what I want..
 Except it seems to have a default unchangable width of 5px... ???
 I tried setting the borderType property to NSNoBorder but that
 made no difference.
 
 How can I get a simple 1px solid colored object that I can use for
 this purpose?
 
 Patrick J. Collins
 http://collinatorstudios.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 jjco...@carouselapps.com wrote:
 
NSUInteger count = [headers count];
__unsafe_unretained id keys[count], values[count];
 
[headers getObjects:values andKeys:keys];
 
for (NSUInteger i=0;icount;i++) {
[request setValue:values[i] forHTTPHeaderField:keys[i]];
}
 
 -- 
 
 Juanjo Conti jjconti http://goog_2023646312@carouselapps.com
 jjco...@carouselapps.com
 
 Software Engineer - Carousel Apps https://carouselapps.com
 
 -- 
 Carousel Apps Limited, registered in England  Wales with registered number 
 7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket 
 Street, London SE1 3HN. Any communication sent by or on behalf of Carousel 
 App Ltd or any of its subsidiary, holding or affiliated companies or 
 entities (together Watu) is confidential and may be privileged or 
 otherwise protected. If you receive it in error please inform us and then 
 delete it from your system. You should not copy it or disclose its contents 
 to anyone. Messages sent to and from Watu may be monitored to ensure 
 compliance with our internal policies and to protect our business. Emails 
 are not secure and cannot be guaranteed to be error free. Anyone who 
 communicates with us by email is taken to accept these risks.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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.  There is the 
tricky bit (for both solutions) of determining when the desktop has changed (or 
you have changed screens).  It is definitely possible, but requires care to get 
the edge cases right.

FWIW, I agree with you on the effect. I may be in the minority on this list, 
but I like the colorfulness of the source lists, and I agree with charles that 
it seems like waste to spend all that processor power just to get the grey of 
the window behind it. It would be nice to have a desktop picture mode.

That said, I am sure Apple at least considered it, and it is possible that it 
caused some sort of cognitive issue in testing (e.g. breaking object 
permanence) which sent things into uncanny valley territory. It is amazing what 
subtle things can have a strong effect.  Filing a radar was the right call, 
IMHO.

Thanks,
Jon


 On Feb 15, 2015, at 6:13 AM, Charles Jenkins cejw...@gmail.com wrote:
 
 I have an idea for improving vibrancy, but right now it’s just a thought 
 experiment. I don’t know how to accomplish it, so I wonder if you guys could 
 provide any advice.
 
 I just posted this suggestion to Apple’s OS X feedback site: Please consider 
 adding NSVisualEffectBlendingModeDesktop and making it the default for 
 objects like the Source View which reside in an app's main or document 
 window. A window with that visual effect mode would use the desktop image 
 ONLY for vibrancy blending. Doing so would be kind to users: they have chosen 
 the desktop image presumably because it and its colors are pleasing. Blending 
 with other randomly intervening windows due to the current default of 
 NSVisualEffectBlendingModeBehindWindow is unkind to users because (a) it 
 ignores the user's clearly expressed preference for the desktop image (b) 
 without conveying any useful information whatsoever.”
 
 Well, I’m not going to hold my breath. But it did occur to me that an app’s 
 main/document window could accomplish something similar by creating its own 
 secondary window that would somehow “stick” behind it. The secondary window’s 
 only purpose would be to replicate the portion of the desktop image occluded 
 by its bounds. That way, no matter what apps are running, it would show a 
 portion of the desktop image, and though users would never actually see this 
 secondary window, the main/document window would blend with it, giving the 
 user pleasing vibrancy using the desktop image he has chosen.
 
 Is this possible, do you think, to open a window that always hides directly 
 behind the working window?  
 
 — 
 
 Charles
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 the.warl0ck.1...@gmail.com wrote:
 
 Hi,
 
 I'm trying to create a circular button, with an rectangular image:
 
self.button.layer.borderColor  = [UIColor blackColor].CGColor;
self.button.layer.borderWidth  = 5;
self.button.layer.cornerRadius = self.button.bounds.size.width / 2.0;
[self.button setBackgroundImage: [UIImage
 imageNamed:@avatar.jpeg] forState:UIControlStateNormal];
 
 But the framework doesn't seem to clip the rectangular image into a
 circular one.
 All extra parts are displayed on screen.
 
 Did I get this wrong? Am I expected to use only circular images?
 
 
 -- 
 Best Regards,
 Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
 Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 the.warl0ck.1...@gmail.com 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://pgp.mit.edu/
 Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 luc.van.boga...@me.com 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. How would I go about to accomplish this?
 I've tried overriding 'isFlipped' in a subclass of the scrollview and the 
 tableview but that didn't seem to make any difference. I didn't think it 
 would be that easy anyway, but I have no idea where to start...
 
 Thanks,
 -- 
 Luc Van Bogaert
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 
when you get relaunched.  It will appear to the user as if the app was running 
the whole time.

Thanks,
Jon


On Jun 18, 2014, at 12:59 PM, Alex Zavatone z...@mac.com wrote:

 Honestly, it seems like it's unrolling the navigation controller for some 
 strange reason when I toggle Personal Hotspot while the app is in the 
 background.
 
 Many times I've seen this happen and even when moving various iPhone's 
 Settings panels to the background, then bringing them to the front again.  
 
 Never saw it before iOS 7, so I was wondering it anyone else has been seeing 
 this.
 
 Since many of our apps need to be run on a VPN, it's expected that the 
 network connection could change due to user action and it's really not 
 optimal if changing network access forces a nav stack unroll.
 
 I'm not even sure that's what's happening, but it sure appears to be after 
 looking at this happening over at least 5 apps for about 9 months.
 
 Has anyone else seen this type of behaviour?
 
 On Jun 18, 2014, at 2:42 PM, Jens Alfke wrote:
 
 
 On Jun 18, 2014, at 11:22 AM, Alex Zavatone z...@mac.com wrote:
 
 Does anyone have any info on what causes the app to seemingly unroll it's 
 Navigation Controller stack and start from the first screen again?
 
 Probably because the OS quit the app while it was backgrounded, and it’s 
 being relaunched?
 
 Back in the day, before app processes persisted in the background, it was 
 important to explicitly save your UI state (controller stack) and restore it 
 on startup, but I suspect a lot of apps don’t pay attention to this anymore 
 since the relaunch doesn’t happen very often.
 
 —Jens
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 nil in this case.

Thanks,
Jon

On Apr 30, 2014, at 1:07 PM, Andy Lee ag...@mac.com wrote:

 On Apr 30, 2014, at 3:21 PM, Jens Alfke j...@mooseyard.com wrote:
 On Apr 30, 2014, at 8:20 AM, Diederik Meijer | Ten Horses 
 diede...@tenhorses.com wrote:
 
 Now here is the problem: although the JSON parses fine and populates a 
 UITableView without any issues, I am still getting the following error:
 
 If the JSON parsed fine, then the error must be coming from somewhere else. 
 A call to JSONObjectWithData: either returns a parsed object, or returns nil 
 and sets the error. It doesn’t do both :)
 
 Which means...
 
   NSError *error;
   id jsonObject = [NSJSONSerialization JSONObjectWithData:self.container 
 options:NSJSONReadingAllowFragments error:error];
   if (error) {
   NSLog(@ERROR: %@, error);
   }
   else {
 
 ...you shouldn't be testing error, you should be checking whether jsonObject 
 is nil, and only then look at the error.  Doing it the wrong way around could 
 explain false errors.  For example, NSJSONSerialization could pessimistically 
 stick an error object in there as the default error, but manage to parse 
 successfully and return a non-nil object.  But then I'm not sure how you 
 could *also* be having your table populated with the right objects.
 
 --Andy
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 gpar...@apple.com wrote:
 
 On Feb 25, 2014, at 6:42 AM, jonat...@mugginsoft.com wrote:
 I have an NSString subclass as below.
 If the subclass doesn’t respond to a given selector I want to forward the 
 selector to another object.
 
 What is the best way to declare the interfaces for DBManagedString and 
 DBManagedObject?
 
 Should I declare a DBManagedObject protocol in which all the methods are 
 optional?
 
 A protocol works. 
 
 Declaring the methods without implementing them also works. 
 Will the complier not complain about the missing implementations?
 
 Jonathan
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 devlists...@gmail.com wrote:

 OK,
 
 So lets assume that you can’t actually prevent the screen being captured. 
 Maybe a solution would be to prevent that captured data from surviving very 
 long.
 
 e.g Install an FSEvents watcher and look out for image and movie files being 
 created on the entire disk. Then delete them while your app is doing its 
 testing.
 
 
 M
 
 On 22 Feb 2014, at 05:38, Bradley O'Hearne br...@bighillsoftware.com wrote:
 
 
 On Feb 21, 2014, at 9:43 PM, dangerwillrobinsondan...@gmail.com wrote:
 They're pointing out valid security issues which are true on all platforms. 
 …
 On any platform, you will need to basically install and run a root kit. 
 
 This is not the case on Windows. It provides the ability to block certain 
 things which public API on OS X does not. We however would like to have an 
 app on OS X that provides the same capabilities as the app on Windows. It is 
 pretty much going to be a major fail if we have to tell large institutions 
 that their students cannot use their Macs for taking tests, because this one 
 hole that test providers want prevented is a trivial matter to block on 
 Windows, but cannot be done on OS X. One reason I’ve continued to pursue 
 this issue is that because it is hard for me to fathom that over the matter 
 of exposing knobs and switches in public API which I have good reason to 
 believe already exist in private API, that the preference would be to leave 
 OS X as a non-option for these kinds of use-cases. 
 
 \You can use the Quartz Display Services API to control the attached 
 displays (see the capture functions for capturing control of the
 
 Already using it. Capturing all displays allows us to display above other 
 apps, preventing other apps and other monitors from displaying other apps. 
 It does nothing to affect screen capture, screen recording, remote desktop, 
 etc.
 
 It is impossible to verify a system is not compromised when the system is 
 outside of physical control at any time prior to running or installing your 
 app. 
 ...
 If they've been convinced of anything else, either they've been lied to by 
 others or they listened to people who really didn't understand security 
 fundamentals.
 ...
 If they're really aware of these issues, then they should have established 
 guidelines on acceptable risks that are not severe enough to them to spend 
 money on, redesign for, or spend time on. 
 
 I appreciate the sentiment, and the thoughts about security theory and 
 philosophy. But no one has lied or misled anyone. The test content providers 
 have a very understandable request: just don’t allow test content to be 
 lifted quickly and en masse with minimal effort. Even Apple’s own engineers 
 I spoke to agreed this was reasonable. None of them attempted to position 
 the problem as being unsolvable, or unreasonable, or in violation of a 
 deeper security theory which needed to be explained to a CEO which just 
 forked out 6 figures to have a high-quality industry certification exam 
 created.
 
 At the end of the day though, on any platform, it is possible another 
 process is running and recording the display stream, input stream, or 
 network traffic or disk or memory writes before your process runs. 
 
 Unless it is the Apple DVD player, which seems to secure its content just 
 fine. 
 
 You'd do well to analyze what processes could and should be running while 
 yours runs and limit it to that as well. (Whitelisting)
 A DTS incident might help you to find out what that might need to be. 
 
 We’ve been doing this for years, and it is something we want to get away 
 from. It is a flawed approach on a number of levels, and a constant 
 headache, and also one that directly opposes the aims of sandboxing / Mac 
 App Store. 
 
 If it can be done in OS X…that’s an answer. If it cannot be done in OS 
 X….that’s also an answer. But telling the client they are unreasonable to 
 want to prevent their test content from being copied — not an answer. The 
 solution might not be immediately apparent or easy, but hey, that’s just new 
 a new problem to solve. 
 
 B
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/devlists.mg%40googlemail.com
 
 This email sent to devlists...@googlemail.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the 

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.  Once a value is in an 
NSNumber, it looses its original type identity, and is simply a number.  You 
can get back any representation you like using the value methods.  -getValue 
allows you to get it back into a scalar, but not necessarily the same type you 
started with.  

I was writing a math program a while back and ran into this exact gotcha. I 
really wanted an -isFloat method, but it seemed to randomly store some floats 
as ints. That was before tagged pointers though, so the implementation may have 
changed (and may change again).

I wouldn’t rely on any undocumented implementation differences. Down that path, 
madness lies…

If you needed to store the creation method, you could write a wrapper around 
NSNumber (A subclass also works if you really need to pass it somewhere as an 
NSNumber, but there are gotchas as it is a class cluster).  Basically write a 
class ‘MyNumber’ which stores a NSNumber as it’s instance variable, and then 
forwards all of it’s methods to it.  You can store the type info in that class 
as it is created. You can also override -isEqual: to have the behavior you want 
(1 != 1f).

Thanks,
Jon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 the numbers which will be used?  
If they are always integers, for instance, that makes the problem a lot easier. 
 In that case I would use the -integerValue of the number and store it in 
NSData as a previous commenter suggested.

If you need floating point values, then the entire problem becomes much harder, 
as using equality with floats is problematic in itself.

Thanks,
Jon

On Feb 22, 2014, at 12:32 AM, Ken Thomases k...@codeweavers.com wrote:

 In the above if key is an NSNumber containing a 5 then  [key monoValue] 
 returns a pointer to a 5.
 
 This betrays the flaw in your thinking.  There's no such thing as a pointer 
 to a 5!  You can have a pointer to an int which contains the value 5.  Or a 
 long which contains the value 5. Or a char which contains the value 5.  Or, 
 and this is the killer, a completely custom representation which only means 
 5 when interpreted by the NSNumber's own methods.  A pointer without the 
 knowledge of which specific storage type it's pointing to is almost useless.  
 Certainly, any recipient of that pointer could not reliably extract the value 
 5 from it or compare it to any other pointer to see if they contain the same 
 thing.
 
 For example, what makes you think that two NSNumbers which compare equal have 
 the same size and byte-wise representation (as output by -getValue:) as each 
 other?  First, one may have been created with +numberWithChar: and the other 
 with +numberWithUnsignedLongLong: and may have consequently used totally 
 different internal storage for the value. Second, there may be padding within 
 the internal representation which is ignored by NSNumber's methods but which 
 would make the data buffers unequal.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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,
Jon


On Aug 24, 2013, at 6:51 PM, Jason Gibbs iosmaniac...@gmail.com wrote:

 Hello everyone,
 
 
 
 I just wanted to introduce  iOSComponents.com to you. We provide Fully
 Functional, Robust, Tested and Ready to use Custom iOSComponents, including
 the iOSDataGrid - the most powerful DataGrid available for iOS Apps, as
 well as a suite of utility controls inluding AutoCompleteUITextView,
 ComboBox, DateComboBox, CheckBox, RadioButton, CheckBoxList,
 MultiSelectComboBox and more!
 
 
 
 It would be great if you could take a look and provide us with feedback,
 criticism, ideas, suggestions, and guidance!
 
 
 
 Here is the website:
 
 
 
 http://ioscomponents.com/
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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:26 PM, Rick Mann rm...@latencyzero.com wrote:

 So, this sort of works, and fails spectacularly.
 
 The problem is that I can't specify the order in which each gesture's values 
 are applied to the view's transform.
 
 So, I end up with a side-to-side panning gesture making the image move 
 up-and-down when it's rotated about 90°.
 
 
 On Jun 14, 2013, at 18:09 , David Rowland rowla...@sbcglobal.net wrote:
 
 Isn't it a matter of implementing this delegate method?
 
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
 shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer 
 *)otherGestureRecognizer
 {
return YES;
 }
 
 
 
 David
 
 
 
 
 
 On Jun 14, 2013, at 5:41 PM, Rick Mann rm...@latencyzero.com wrote:
 
 The Apple Maps application allows you to pan, zoom, and rotate in a single 
 two-finger gesture.
 
 Is that done with three gesture recognizers all operating simultaneously? 
 Or are they just handling the touches directly?
 
 I don't see how to get a combined transform out of the three separate 
 gesture recognizers.
 
 -- 
 Rick
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rowlandd%40sbcglobal.net
 
 This email sent to rowla...@sbcglobal.net
 
 
 
 -- 
 Rick
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 you are using NSBezierPath, then it is a bit easier:

[color set];
[path fill];


Note: This code was written off the top of my head in mail.

Thanks,
Jon


On Jun 6, 2013, at 1:44 AM, Nick Rogers roger...@mac.com wrote:

 Hi,
 
 I'm new to core graphics.
 The target oval (target oval.jpg) and current oval (oval.jpg) are available 
 at 
 http://www5.snapfish.in/snapfishin/thumbnailshare/AlbumID=9188624025/a=11429776025_11429776025/otsc=SHR/otsi=SALBlink/
  .
 In oval after drawing the top filled ellipse I'm creating a path that moves 
 from a point on the ellipse to its centre and then back to another point on 
 the ellipse thus forming a slice.
 The problem is how to fill this elliptical slice with a different colour.
 
 Please help.
 Nick
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 
using a CGPath.

You may also want to consider a view-based outline view, as it is a bit easier 
to work with, and will be easier to show a popover from.

Finally, from an interaction design perspective, you may want your cell/view to 
look a bit different than a NSPopupButtonCell, as things which behave 
differently should look different.

Thanks,
Jon

On May 22, 2013, at 2:19 PM, Steve Mills smi...@makemusic.com wrote:

 On May 22, 2013, at 16:15:31, Alex Zavatone z...@mac.com
 wrote:
 
 I've got a simple case for iOS that I can send you where I issue an 
 UIPopoverController and a PopoverContentViewController from a UIButton in a 
 UINavigationBar.
 
 Sounds like you're trying to do this in the Mac, but if you think it will 
 help, I'll strip the project down to the minimum and send your way.  Will 
 work on iOS 5 and up, Xcode 4.2 and up.
 
 Yes, OS X, not iOS. If your case doesn't involve an outline view or table 
 view, I don't think it will be of much help. I already have code to show a 
 popover from a button. I'm asking about showing a popover from a call in an 
 outline view.
 
 As for retheme-ing the border for the popover, haven't tried that yet.  If 
 you need some close to accurate triangles, I can get those for you and you 
 can put them in a UIImageView over the button.
 
 I'm not retheming the popover. I asked about drawing a popup triangle.
 
 --
 Steve Mills
 office: 952-818-3871
 home: 952-401-6255
 cell: 612-803-6157
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 edole...@gmail.com 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 
 calling methods on my object if I can pass all with initwithframe somehow.
 
 Thanks,
 Eric
 
 Sent by Eric's faithful iPad. 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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 rm...@latencyzero.com wrote:

 Hi. Does anyone know the difference between WWDC videos and slides? I can't 
 quite figure it out, but when I was downloading on my iPad, I got audio with 
 no video. Then I tried something else and got video. Now I'm on the Mac, and 
 I think what's called slides is actually video. Not sure.
 
 -- 
 Rick
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: WWDC videos vs. slides?

2012-11-16 Thread Jonathan Hull
Sounds like a glitch.  I think that has happened to me a couple of times.  
Reloading the page (or possibly restarting Safari) should fix it.  Worst case, 
you should be able to download it on your iPad and watch it in your video app.

Thanks,
Jon


On Nov 16, 2012, at 8:54 PM, Rick Mann rm...@latencyzero.com wrote:

 
 On Nov 16, 2012, at 20:43 , Jonathan Hull jh...@gbis.com 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 logo, and 
 plays the audio. It's almost useless, since you can't see the code or 
 diagrams they're talking about (on iPad).
 
 -- 
 Rick
 
 
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 21, 2012, at 6:10 PM, Damien Cooke dam...@smartphonedev.com wrote:

 Hi all,
 I have a perplexing issue where I think I know the answer but can not make it 
 work
 
 
 I have a custom UINavigation controller with a custom titlebar
 
 This is achieved in the UINavigationController subclass in the - 
 (void)viewDidLoad
 
 UIImageView *imageView = [[UIImageView alloc] 
 initWithFrame:CGRectMake(0,0,320,49)];
 imageView.image = [UIIMage imageNamed:@some_image];
 [self.view addSubview:imageView];
 
 
 in the same method I added the following
 self.view.autoresizingMask = 
 UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleTopMargin;
 
 this works fine.
 
 if I turn on Personal hotspot or put a phone call in the background, I get a 
 20px extension to the status bar.
 
 what happens is the new bar extension pops over my image and the view drops 
 down 20 px.  what I wanted was my image in the titlebar to drop down with the 
 view.  So I tried to add to the imageView the following:
 
 imageView.autoresizingMask = 
 UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleTopMargin;   
 
 This had no visible effect.
 
 So I went to the ViewController that was to populate the navigation 
 controller and set the auto-resize flags on the View to be the same as the 
 UINavigationController subclass.
 
 Still no improvement.
 
 Can someone please point me in the right direction.  Or have I got this right 
 but something is wrong somewhere else?
 
 Regards
 Damien
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 not an 
operation itself, then you probably want to look at -setCompletionBlock:.  The 
block you provide will get called once the operation is complete (and let you 
clean things up, etc…).  Note that the block may not be called on the main 
thread.

Thanks,
Jon

On Oct 20, 2012, at 10:15 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 
 On Oct 20, 2012, at 12:53 PM, Gary L. Wade garyw...@desisoftsystems.com 
 wrote:
 
 At the time when you call waitUntilAllOperationsAreFinished, no operations 
 have been added, so there's nothing to wait on. Add the operation to the 
 queue first and then call wait.
 --
 
 I tried that too, but then it just stays in the operation and never finishes:
 
 start import
 begin of importRecords in operation
 
 and nothing else, it just sits there.
 
 - Koen.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

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).

[myButton setContentHuggingPriority:UILayoutPriorityDefaultLow 
forAxis:UILayoutConstraintAxisVertical];

Thanks,
Jon

 
On Sep 29, 2012, at 2:52 PM, Eric Gorr mail...@ericgorr.net wrote:

 I am trying to wrap my head around the auto-layout functionality.
 
 I have a sample project at:
 
   http://ericgorr.net/cocoadev/constraints.zip
 
 After opening the project, take a look at ELGFirstViewController.xib. 
 
 This app will only be used in landscape.
 
 On this XIB, there are three objects.
 
 (1) A button 
 (2) A label
 (3) A Table View
 
 What I am looking to do is the following:
 
 1. I want the table view to be a fixed height of 648 pixels. It should be the 
 full width of it's superview and anchored at the bottom.
 2. The label should be immediately above the table, with no vertical 
 separation between it and the table view. It should also be the full width of 
 the superview and it's height should remain fixed.
 3. The button should be located at the right, with no vertical separation 
 between it and the label. There should be no vertical separation between it 
 and top of the super view. The height of the button is what I would like to 
 be variable.
 
 I have tried playing around with the height constraint of the button, 
 lowering it's priority, but in every case, it is the height of the table view 
 that shrinks.
 
 How can I set up the constraints so the height of the button is variable? Is 
 this possible to specify within IB or is the something I will need to do in 
 code?
 
 
 
 I can, of course, just fix the height of the button since I know how many 
 pixels I will have remaining, but, again, I was interesting in learning 
 something about auto-layout and was having trouble resolving this problem.
 
 
 Thank you.
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 values (number objects) for subprojects, from 
 which I calculate the overall progress .
 The array is an atomic property of the project class.
 
 Is it safe to access this array from multiple threads, using methods like 
 objectAtIndex and replaceObjectAtIndex?
 
 Jan E.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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 doing so if it proved beneficial to 
 the implementation (as well as, of course, using the hashes of the key 
 objects). But there's also NSSet, NSCountedSet and NSOrderedSet, where the 
 [un-copied] object *is* the key, as well as things like NSMapTable. And 
 there's nothing preventing NSArray from keeping a supplementary hash-based 
 index to assist in looking up objects, although I can't imagine it's ever 
 likely to be implemented that way.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com