Re: Core Data or not

2016-08-05 Thread Luther Baker
Little different perspective, Core Data tends to work drop dead easy for
simple stuff. Small data set with simple functionality should work straight
out of the box easy.

And there is nothing wrong with creating a manual array of managed objects
from a Core Data result set.

I personally wouldn't stray from Core Data until you hit pain points,
performance problems or functionality limitations.

Core Data is like autolayout in that, it generally works very well for
simple things (which it sounds like you're after).

Just my $0.02,
Luther

On Fri, Aug 5, 2016 at 3:57 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Aug 5, 2016, at 07:46 , Trygve Inda  wrote:
> >
> > Somehow this seems easier to do without Core Data.
>
> If you’ll accept my opinion as commentary and not anything more dire, I’d
> say that your proposed course of action is based on several clearly
> undesirable options:
>
> 1. For 5,000 records, I don’t think there’s enough data to justify using
> Core Data at all, given the amount of development pain you can expect. Core
> Data is famous for pain. Your project may be the exception, where
> everything goes smoothly and Core Data brings a smile to your face, but I
> wouldn’t bet on it.
>
> 2. For 5,000 records, you do need a storage solution. If non-local storage
> is possible, then I’d suggest you look very seriously at CloudKit. It’s
> what Apple did *instead* of making Core Data usable for mere mortals. You
> may still need some kind of local persistence, but if only a few hundred
> records are needed locally, keeping them (or enough of their properties to
> populate your table view) in RAM may be enough.
>
> 3. If you must have local persistent storage, then I’d suggest one of the
> 3rd party databases. I recommend these behind CloudKit only because over
> time 3rd party libraries tend to embroil you in update compatibility woes,
> whereas sticking with Apple software means you know where you stand with
> updates and backward compatibility.
>
> 4. NSXxxController is a glue object, which exists only to let you avoid
> writing code that’s largely boilerplate. IMO it’s a terrible mistake to it
> them as an app *design* element. These classes are pure implementation.
>
> 5. The NSXxxController functions of sorting and filtering have their
> counterparts in Core Data and also in any decent persistent storage system
> that has database-like semantics. No need to think about NSXxxController.
>
> 6. Depending on what is involved with your “interestingness” property (the
> one that defines the subset of 200 or so records), you may be able derive
> it in the NSTableView data source (by logically combining two groups of
> records), or by providing a derived property, or by using Core
> Data/database fetch predicates, or by storing something in the database
> itself. What you do depends on the complexity of the property, but none of
> the options need NSXxxController.
>
> ___
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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

iOS Status Bar and Modal Presentation

2016-07-04 Thread Luther Baker
I am "presenting" a view controller (*modaly*) on an iPhone and I'd like to
hide the status bar while the *modal* view controller is visible. I've
implemented prefersStatusBarHidden on the presented view controller and
indeed, the status bar is hidden when the modal view controller is
presented - but, the *presenting* view controller, which correctly shows
the status bar, jerks and also hides the status bar on its own view while
transitioning to the modal view controller (default bottom up transition).

When I dismiss the modal view controller (default down transition) the
presenting view controller correctly appears underneath with the status bar
showing.

I find the jerkiness annoying and unexpected - I think the presenting view
controller should sit still. prefersStatusBarHidden is implemented to
return true on the presented view controller, not the presenting view
controller. Before I file a radar, anyone have a guess as to whether this
is a bug or expected behavior?

In the meantime, any thoughts on a elegant work around? Manual attempts to
animate the status bar away in the completion block of presentViewController
method aren't really continuous or smooth with respect to the presenting
animation.

Thanks,
-Luther

PS: the 2 view controllers mentioned are contained within
UINavigationControllers ... if that makes a difference.
___

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: Supreme aggravation with UITextField controls and the #@Q% return button

2016-07-04 Thread Luther Baker
I think you're using the wrong method ... textFieldDoneEditing fires when a
control loses focus, not when the "return" key gets tapped.

Try implementing

optional func textFieldShouldReturn(_ *textField*: UITextField
)
-> Bool


https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextFieldDelegate_Protocol/#//apple_ref/occ/intfm/UITextFieldDelegate/textFieldShouldReturn
:

Thanks,
-Luther



On Mon, Jul 4, 2016 at 2:17 PM, William Squires 
wrote:

> When making any iOS application project (Xcode 7.something, on 10.11.5,
> base SDK = iOS 9) that uses a UITextField control, I can't get the "return"
> button to work.
>
> I've tried attaching an IBAction by Ctrl-dragging from the control to the
> .swift file for the view controller, naming the action, and selecting
> "Action" (instead of "outlet"), and it creates the action method as below:
>
> @IBAction func textFieldDoneEditing(sender: UITextField) {
>   print("textFileDoneEditing:")
>   sender.resignFirstResponder()
>   }
>
> I've verified that the connection is valid. Not only does the
> dot-in-a-circle show up to the left of the func, I can see that it's
> connected in the connections inspector pane. When I run (simulator or
> actual device) no output is logged to the console when the return key on
> the on-screen keyboard is tapped (clicked, in the case of the simulator.)
>
> I also tried setting my view controller to implement UITextFieldDelegate
>
> class ViewController : UIViewController , UITextFieldDelegate
> {
> ...
> func textFieldDidEndEditing(textField: UITextField) {
>   print("textFieldDidEndEditing:")
>   self.resignFirstResponder()
>   }
>
> then went back to IB and the connections inspector pane. I then selected
> both of my UITextFields and made sure the delegate was connected to the
> proxy for the view controller (at the top of the "view controller" IB
> representation, to the left of the "File's Owner" and "Exit" proxies).
>
> In neither case, does this work on either the simulator or device. Only
> once I tap on the other UITextField (set to have a numeric keypad) do both
> methods print to the console, by which time it's too late; the other text
> field already has the focus (first responder status.)
>
> I don't know if this is an iOS bug, or an ID10T error (stupidity on my
> part). Please help!!
>
> BTW, I also have two outlets to the UITextFields in question, one named
> "nameField" and one named "numberField". The first has the "default"
> keyboard, and the 2nd has the "numpad" keyboard; it's the first one that
> has the non-responsive "return" button (since a numpad keyboard doesn't
> have a "return" button - a sad oversight, IMHO)
>
>
>
> ___
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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 Hardware Keyboard Detection

2016-04-06 Thread Luther Baker
I hear ya.

Keyboards, keystrokes and text management have always been so opaque on
iOS. I think that might make it easier for devs to get up and running but
if we're to write world class apps to compete with the desktop at all, I
think we're going to need better text handling abstractions.

Just my $0.02. I'm going to have to resort to some brittle trickery to get
what I want for now.

Thanks,
Luther
On Wed, Apr 6, 2016 at 9:21 AM Igor Ranieri Elland <i...@elland.me> wrote:

> I’ve been filing radars and complaining about this for almost 3 years now
> (since iOS7). So far the only way to detect if a hardware keyboard is
> present is through private APIs (and those only if a text view on text
> field is currently the first responder).
>
> If anyone has a good solution, I’d be happy to hear it.
>
> Best,
> Igor
>
>
> > Am 06.04.2016 um 16:06 schrieb Luther Baker <lutherba...@gmail.com>:
> >
> > If not there already, it seems like this type of functionality needs to
> be
> > on the critical path ... or someone's radar?
> >
> > How does one take advantage of the screen if there is no authoritative
> way
> > to determine if the keyboard is covering half of it? Especially since the
> > pro's case now comes with a built-in hardware keyboard.
> >
> > I'd be curious if the HIG speaks to this.
> >
> > Maybe it's just a 9.3 bug in the keyboard notifications 
> > On Tue, Apr 5, 2016 at 8:04 PM Luther Baker <lutherba...@gmail.com>
> wrote:
> >
> >> I'm building an app for the iPad 2 and iPad Pro and need to present a
> >> modal differently, depending on whether or not there is a hardware
> keyboard
> >> attached.
> >>
> >> The keyboard notifications keep giving me the rect for the screen
> >> keyboard, whether or not it appears.
> >>
> >> Thanks,
> >> Luther
> >>
> > ___
> >
> > 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/igor%40elland.me
> >
> > This email sent to i...@elland.me
>
>
___

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 Hardware Keyboard Detection

2016-04-06 Thread Luther Baker
If not there already, it seems like this type of functionality needs to be
on the critical path ... or someone's radar?

How does one take advantage of the screen if there is no authoritative way
to determine if the keyboard is covering half of it? Especially since the
pro's case now comes with a built-in hardware keyboard.

I'd be curious if the HIG speaks to this.

Maybe it's just a 9.3 bug in the keyboard notifications 
On Tue, Apr 5, 2016 at 8:04 PM Luther Baker <lutherba...@gmail.com> wrote:

> I'm building an app for the iPad 2 and iPad Pro and need to present a
> modal differently, depending on whether or not there is a hardware keyboard
> attached.
>
> The keyboard notifications keep giving me the rect for the screen
> keyboard, whether or not it appears.
>
> Thanks,
> Luther
>
___

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

iOS Hardware Keyboard Detection

2016-04-05 Thread Luther Baker
I'm building an app for the iPad 2 and iPad Pro and need to present a modal
differently, depending on whether or not there is a hardware keyboard
attached.

The keyboard notifications keep giving me the rect for the screen keyboard,
whether or not it appears.

Thanks,
Luther
___

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: Smoother becomeFirstResponder animation

2016-04-03 Thread Luther Baker
Hi Alex,

I am using an iPhone. Disconnected, the keyboard seems to come right up.
I'm triggering actions to the first responder using viewWillAppear and
viewWillDisappear and they seem to look fine on the device. Specifically,
the keyboard comes up right along with the presented view controller - both
controls rise from the bottom and look close to simultaneous.

Dismissal generally looks fine as well. Keyboard seems to go away correctly
such that subsequent starts look good.

I will note that - when connected to Xcode, the first modal presentation
takes forever, device or simulator. There is something going on there that
doesn't occur when I'm on device only. I assume it has to do with debugging
... Subsequent modal presentations work seem to work normally.

Hope that helps,
-Luther



On Sun, Apr 3, 2016 at 1:32 PM, Alex Zavatone <z...@mac.com> wrote:

> Luther, please try this.
>
> Unplug your app from your Mac and don’t launch it from Xcode.
>
> Tell me how long it takes to display the keyboard.
>
> Also, please tell me if you are using an iPhone or an iPad.
>
> I ran into this about 6 months ago and want to see if it is the same thing.
>
> Cheers.
> Alex Zavatone
>
> On Apr 3, 2016, at 10:53 AM, Luther Baker <lutherba...@gmail.com> wrote:
>
> > More information
> >
> > As an experiment, if I tie the DISMISS button solely to resigning first
> > responder ... and wait some amount of time before tapping SAVE to simply
> > dismiss the view controller, the KEYBOARD pops back up while the view
> > controller is dismissing!
> >
> > There must be a problem passing becomeFirstResponder from the presented
> > view controller directly to the textfield.
> >
> > -Luther
> >
> >
> > On Sun, Apr 3, 2016 at 9:26 AM, Luther Baker <lutherba...@gmail.com>
> wrote:
> >
> >> I am presenting a newly instantiated modal view controller (iOS, shows
> up
> >> from the bottom) and I'd like to have one of the text fields immediately
> >> becomeFirstResponder.
> >>
> >> *Approach #1:*
> >>
> >> If I invoke this directly in the presented view controller's
> >> viewWillAppear, I see some presentation animation artifacts.
> >>
> >> *Approach #2:*
> >>
> >> If I put textField.becomeFirstResponder in viewDidAppear, it feels like
> >> the user has to wait too long to see the keyboard. In addition, if I
> >> perform a series of present, dismiss, present, dismiss, etc -- the
> keyboard
> >> stops animating and starts to just "pop" into place once the view
> >> controller has finished. Maybe it doesn't "pop" as much as it simply
> >> animates much faster on subsequent requests.
> >>
> >> I've also tried to tell the textField to become first reponder in the
> >> completion handler of the originating present view controller method ---
> >> and it behaves similar to the viewDidAppear method mentioned above.
> >>
> >> What I'd like ... is to animated the keyboard ALONGSIDE the modal
> >> presentation. Is anyone aware of an effective way to do that? For what
> it's
> >> worth, I am using a mildly custom animation and taking advantage of
> >>
> >>transitionCoordinator.animateAlongsideTransition
> >>
> >> but I'm just animating some alpha values. I don't know if we can tie
> >> keyboard animations into the transitionCoordinator. My current
> >> understanding is that we don't really have any control over the keyboard
> >> animation.
> >>
> >> As an aside, resigning responder in viewWillDisappear seems to work ok
> for
> >> now but if possible, I'd prefer to explicitly animate it alongside the
> >> modal dismissal as well. Part of me wonders if the "pop"ing into place
> as
> >> mentioned above is related to a previous, incorrectly dismissed,
> keyboard.
> >> It seems to "remember" it was recently used.
> >>
> >> *Final Approach #3:*
> >>
> >> One more point: if I put textField.becomeFirstResponder in the presented
> >> view controller's "becomeFirstResponder" method, I seem to get a
> decently
> >> smooth keyboard animation alongside the modal presentation. In
> addition, it
> >> seems that the view controller's "becomeFirstResponder" is invoked
> >> automatically so I get this for free. BUT, dismissal is completely
> messed
> >> up. The call to resign first responder in viewWillDisappear no longer
> works
> >> and the keyboard lingers around for a bit after the presented vie

Re: Smoother becomeFirstResponder animation

2016-04-03 Thread Luther Baker
I am having better luck with viewWillAppear and viewWillDisappear on the
device proper as opposed to the simulator. It seems to work reasonably well
for what I want.



On Sun, Apr 3, 2016 at 9:53 AM, Luther Baker <lutherba...@gmail.com> wrote:

> More information
>
> As an experiment, if I tie the DISMISS button solely to resigning first
> responder ... and wait some amount of time before tapping SAVE to simply
> dismiss the view controller, the KEYBOARD pops back up while the view
> controller is dismissing!
>
> There must be a problem passing becomeFirstResponder from the presented
> view controller directly to the textfield.
>
> -Luther
>
>
> On Sun, Apr 3, 2016 at 9:26 AM, Luther Baker <lutherba...@gmail.com>
> wrote:
>
>> I am presenting a newly instantiated modal view controller (iOS, shows up
>> from the bottom) and I'd like to have one of the text fields immediately
>> becomeFirstResponder.
>>
>> *Approach #1:*
>>
>> If I invoke this directly in the presented view controller's
>> viewWillAppear, I see some presentation animation artifacts.
>>
>> *Approach #2:*
>>
>> If I put textField.becomeFirstResponder in viewDidAppear, it feels like
>> the user has to wait too long to see the keyboard. In addition, if I
>> perform a series of present, dismiss, present, dismiss, etc -- the keyboard
>> stops animating and starts to just "pop" into place once the view
>> controller has finished. Maybe it doesn't "pop" as much as it simply
>> animates much faster on subsequent requests.
>>
>> I've also tried to tell the textField to become first reponder in the
>> completion handler of the originating present view controller method ---
>> and it behaves similar to the viewDidAppear method mentioned above.
>>
>> What I'd like ... is to animated the keyboard ALONGSIDE the modal
>> presentation. Is anyone aware of an effective way to do that? For what it's
>> worth, I am using a mildly custom animation and taking advantage of
>>
>> transitionCoordinator.animateAlongsideTransition
>>
>> but I'm just animating some alpha values. I don't know if we can tie
>> keyboard animations into the transitionCoordinator. My current
>> understanding is that we don't really have any control over the keyboard
>> animation.
>>
>> As an aside, resigning responder in viewWillDisappear seems to work ok
>> for now but if possible, I'd prefer to explicitly animate it alongside the
>> modal dismissal as well. Part of me wonders if the "pop"ing into place as
>> mentioned above is related to a previous, incorrectly dismissed, keyboard.
>> It seems to "remember" it was recently used.
>>
>> *Final Approach #3:*
>>
>> One more point: if I put textField.becomeFirstResponder in the presented
>> view controller's "becomeFirstResponder" method, I seem to get a decently
>> smooth keyboard animation alongside the modal presentation. In addition, it
>> seems that the view controller's "becomeFirstResponder" is invoked
>> automatically so I get this for free. BUT, dismissal is completely messed
>> up. The call to resign first responder in viewWillDisappear no longer works
>> and the keyboard lingers around for a bit after the presented view
>> controller goes away. This is odd - it seems as if symmetric calls are
>> required to get a proper dismissal (viewDidAppear / viewWillDisappear) as
>> opposed to (becomeFirstResponder / viewWillDisappear).
>>
>> Sorry for the length. Any thoughts?
>>
>> Thanks,
>> -Luther
>>
>>
>
___

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: Smoother becomeFirstResponder animation

2016-04-03 Thread Luther Baker
More information

As an experiment, if I tie the DISMISS button solely to resigning first
responder ... and wait some amount of time before tapping SAVE to simply
dismiss the view controller, the KEYBOARD pops back up while the view
controller is dismissing!

There must be a problem passing becomeFirstResponder from the presented
view controller directly to the textfield.

-Luther


On Sun, Apr 3, 2016 at 9:26 AM, Luther Baker <lutherba...@gmail.com> wrote:

> I am presenting a newly instantiated modal view controller (iOS, shows up
> from the bottom) and I'd like to have one of the text fields immediately
> becomeFirstResponder.
>
> *Approach #1:*
>
> If I invoke this directly in the presented view controller's
> viewWillAppear, I see some presentation animation artifacts.
>
> *Approach #2:*
>
> If I put textField.becomeFirstResponder in viewDidAppear, it feels like
> the user has to wait too long to see the keyboard. In addition, if I
> perform a series of present, dismiss, present, dismiss, etc -- the keyboard
> stops animating and starts to just "pop" into place once the view
> controller has finished. Maybe it doesn't "pop" as much as it simply
> animates much faster on subsequent requests.
>
> I've also tried to tell the textField to become first reponder in the
> completion handler of the originating present view controller method ---
> and it behaves similar to the viewDidAppear method mentioned above.
>
> What I'd like ... is to animated the keyboard ALONGSIDE the modal
> presentation. Is anyone aware of an effective way to do that? For what it's
> worth, I am using a mildly custom animation and taking advantage of
>
> transitionCoordinator.animateAlongsideTransition
>
> but I'm just animating some alpha values. I don't know if we can tie
> keyboard animations into the transitionCoordinator. My current
> understanding is that we don't really have any control over the keyboard
> animation.
>
> As an aside, resigning responder in viewWillDisappear seems to work ok for
> now but if possible, I'd prefer to explicitly animate it alongside the
> modal dismissal as well. Part of me wonders if the "pop"ing into place as
> mentioned above is related to a previous, incorrectly dismissed, keyboard.
> It seems to "remember" it was recently used.
>
> *Final Approach #3:*
>
> One more point: if I put textField.becomeFirstResponder in the presented
> view controller's "becomeFirstResponder" method, I seem to get a decently
> smooth keyboard animation alongside the modal presentation. In addition, it
> seems that the view controller's "becomeFirstResponder" is invoked
> automatically so I get this for free. BUT, dismissal is completely messed
> up. The call to resign first responder in viewWillDisappear no longer works
> and the keyboard lingers around for a bit after the presented view
> controller goes away. This is odd - it seems as if symmetric calls are
> required to get a proper dismissal (viewDidAppear / viewWillDisappear) as
> opposed to (becomeFirstResponder / viewWillDisappear).
>
> Sorry for the length. Any thoughts?
>
> Thanks,
> -Luther
>
>
___

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

Smoother becomeFirstResponder animation

2016-04-03 Thread Luther Baker
I am presenting a newly instantiated modal view controller (iOS, shows up
from the bottom) and I'd like to have one of the text fields immediately
becomeFirstResponder.

*Approach #1:*

If I invoke this directly in the presented view controller's
viewWillAppear, I see some presentation animation artifacts.

*Approach #2:*

If I put textField.becomeFirstResponder in viewDidAppear, it feels like the
user has to wait too long to see the keyboard. In addition, if I perform a
series of present, dismiss, present, dismiss, etc -- the keyboard stops
animating and starts to just "pop" into place once the view controller has
finished. Maybe it doesn't "pop" as much as it simply animates much faster
on subsequent requests.

I've also tried to tell the textField to become first reponder in the
completion handler of the originating present view controller method ---
and it behaves similar to the viewDidAppear method mentioned above.

What I'd like ... is to animated the keyboard ALONGSIDE the modal
presentation. Is anyone aware of an effective way to do that? For what it's
worth, I am using a mildly custom animation and taking advantage of

transitionCoordinator.animateAlongsideTransition

but I'm just animating some alpha values. I don't know if we can tie
keyboard animations into the transitionCoordinator. My current
understanding is that we don't really have any control over the keyboard
animation.

As an aside, resigning responder in viewWillDisappear seems to work ok for
now but if possible, I'd prefer to explicitly animate it alongside the
modal dismissal as well. Part of me wonders if the "pop"ing into place as
mentioned above is related to a previous, incorrectly dismissed, keyboard.
It seems to "remember" it was recently used.

*Final Approach #3:*

One more point: if I put textField.becomeFirstResponder in the presented
view controller's "becomeFirstResponder" method, I seem to get a decently
smooth keyboard animation alongside the modal presentation. In addition, it
seems that the view controller's "becomeFirstResponder" is invoked
automatically so I get this for free. BUT, dismissal is completely messed
up. The call to resign first responder in viewWillDisappear no longer works
and the keyboard lingers around for a bit after the presented view
controller goes away. This is odd - it seems as if symmetric calls are
required to get a proper dismissal (viewDidAppear / viewWillDisappear) as
opposed to (becomeFirstResponder / viewWillDisappear).

Sorry for the length. Any thoughts?

Thanks,
-Luther
___

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: #selector noob question

2016-03-22 Thread Luther Baker
Thanks for posting this extended answer!
On Mon, Mar 21, 2016 at 11:34 PM Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Mar 21, 2016, at 20:27 , Eric E. Dolecki  wrote:
> >
> > Quick question. If I use #selector(funcName) - does it always send an
> > argument of the obj if the func requests it or not?
> >
> > If the function being called has a typed argument of something like
> > sender:UIButton, I can reference the sender in the func. Before with a
> > string we could add the ":" to inform that it would be supplied. Now is
> it
> > implied that it will be supplied?
>
> 1. The “:” was never optional, in the sense that you could choose whether
> or not to “add” it. Obj-C @selector(funcName) and @selector(funcName:) —
> “funcName” and “funcName:” in the previous Swift — are completely unrelated
> selectors. When performing the first of these selectors, there was never a
> parameter, and when performing the second there was always a parameter.
>
> 2. Selectors don’t send messages, selectors *are* messages. They are,
> approximately, polymorphic (class-independent) method names known to the
> runtime.
>
> When performing a selector, it has always been necessary to supply the
> correct number of arguments. It was an implementation detail of the Obj-C
> runtime that omitting or oversupplying parameters would not necessarily
> crash, and this fact could be exploited sometimes.
>
> 3. The new #selector syntax specifies the method by qualified name (via an
> expression that isn’t evaluated). For example:
>
> > import Cocoa
> >
> > let x1 = #selector (NSView.addSubview(_:))
> >
> > let v: NSView
> > let x2 = #selector (v.addSubview(_:))
> >
> > class A: NSView
> > {
> >   let x3 = #selector (addSubview(_:))
> > }
>
>
> These 3 declarations specify the single-parameter addSubview method
> explicitly, by specifying the parameter keyword (_). They differ in the way
> they tell the compiler which class to consult to determine whether/how
> ‘addSubview:’ is declared.
>
> But Swift has additional source code forms. If it’s unambiguous which
> method is meant, you can just use the method name without keywords:
>
> > class A: NSView
> > {
> >   let x4 = #selector (isDescendantOf) // OK because there is only
> one matching method
> >   let x5 = #selector (addSubview) // ambiguous
> > }
>
>
> and you can use ‘as’ to specify the type of function, to distinguish
> between overloaded functions that have the same name and parameter
> keywords, but different parameter or return types.
>
> Note that x4 corresponds to Obj-C @selector(isDescendantOf:), not
> @selector(isDescendantOf).
>
> 4. Swift selectors are still polymorphic, so they aren’t tied to a class
> at runtime. For example, x1 above doesn’t mean “the selector for
> ‘addSubview:’ in class NSView". It means “the selector for method
> addSubview:, using NSView’s addSubview: method as a pattern to resolve any
> ambiguities”. You can still perform such a selector on any class that has a
> matching method, just like in Obj-C.
>
> 5. The problem being solved here is that in Obj-C the compiler can’t check
> that a selector is valid. There are two parts to this:
>
> a. It can only check that a method exists for a selector if a header file
> declaring that method is #imported into the current compilation.
>
> b. It cannot check the return type safely under any circumstances, leading
> to crashes when methods exist with the same selector but different return
> types.
>
> Swift solves the problem by requiring you to be explicit about which
> function signature the selector represents.
>
> ___
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: UIDocument with NSFileWrapper

2016-03-21 Thread Luther Baker
Thanks for posting this. Exploring UIDocument and caching/parsing JSON
instead of CoreData for a service based mobile app that must support
offline mode ... and looking forward to considering where you landed.
On Mon, Mar 21, 2016 at 5:11 PM  wrote:

>
> > On Mar 21, 2016, at 2:08 AM, Quincey Morris <
> quinceymor...@rivergatesoftware.com> wrote:
> >
> > On Mar 19, 2016, at 18:54 , davel...@mac.com wrote:
> >>
> >> What I’m having trouble understanding is how I store the images (whose
> filenames will vary from document to document) with NSFileWrapper. In my
> top level directory do I have my main model file as a JSON file along with
> a file (JSON or plist) that lists all the images and then have an Image
> directory that another NSFileWrapper is used to read/write the images (that
> are stored in the Image subdirectory)?
> >>
> >> Or can I simply store all the files without a subdirectory? I still
> suspect I need to have a file with a fixed name (such as image.plist) that
> tells me what all the other filenames are to put in the NSFileWrapper (vs.
> using NSFileManager to ask for the name of all the files).
> >
> > There’s no correct answer to these questions. It’s a design problem
> whose answer is whatever works best in your use case. I’d recommend you
> start by choosing what looks to you like the most straightforward approach,
> then be prepared to revise your strategy later if it doesn’t work out well.
> (The amount of code relating to file wrappers is likely to be small
> relative to the code that generally maintains your data model, so rewriting
> it shouldn’t be onerous. However, that suggests it would be prudent not to
> let the wrappers propagate too deeply into the model. Keep them as an
> artifact of the save mechanism in particular, rather than the data model in
> general.)
> >
>
> Ok, thanks again for all your feedback. I took a stab at implementing it
> yesterday. Everything is in my subclass of UIDocument. The rest of the
> model is a layer below the UIDocument subclass (i.e., the subclass has a
> couple instance variables which are the main model) although I did put a
> few methods in the UIDocument class to add the images since that needs to
> change the NSFileWrapper.
>
> I think I've got it working. Here is how I did it (in case this helps
> anyone else and in case anyone else sees a problem with this).
>
> UIDocument subclass has a NSFIleWrapper instances for each of these:
>
> 1. Top level NSFileWrapper directory wrapper.
> 2. It contains a directory wrapper for a subdirectory named Images where
> all the image files (that won't be updated often go). I put the method to
> add an image here so that it could update the NSFileWrapper
> 3. a NSFileWrapper that contains a single file that is a list of all the
> image filenames that is added to the top level NSFileWrapper
> 4. a NSFileWrapper for the rest of the model that will change often and is
> added to the top level NSFileWrapper
>
> Whenever an image is added, I remove the NSFileWrapper in #3 from the top
> level file wrapper, created a new NSFileWrapper with the new list of
> images, and then add that to the top level NSFileWrapper. And add the image
> file to the NSFileWrapper in #2. It appears you must call removeFileWrapper
> on the top level NSFileWrapper and then add the new NSFileWrapper with
> addFileWrapper rather than just calling addFileWrapper with the same
> preferred filename and replacement NSFileWrapper. Similarly with my #4 main
> data model file, I call removeFileWrapper and addFileWrapper each time a
> save occurs since this data changes frequently.
>
> Since images won't be added as often as the rest of the model is updated,
> I'm hoping this won't cause these images to be re-written every time a save
> is performed but I'm not certain how to verify this is the case.
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: UICollectionView Moving

2016-03-10 Thread Luther Baker
That was it. Thanks Luke!

Really digging this control ...

On Wed, Mar 9, 2016 at 10:36 AM, Luke Hiesterman <luket...@apple.com> wrote:

> UICollectionView doesn’t know that your layout is conceptually columns, so
> when a section is empty, it has no concept of what space is appropriate to
> drop items into an empty section. You need to help it out by overriding the
> following method on your layout:
>
> - (NSIndexPath *)targetIndexPathForInteractivelyMovingItem:(NSIndexPath
> *)previousIndexPath withPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);
>
> Luke
>
> On Mar 9, 2016, at 5:58 AM, Luther Baker <lutherba...@gmail.com> wrote:
>
> Ok - I think this is the final question.
>
> I've created a layout that is essentially a bunch of ragged bottom columns
> - like a Trello or Kanban board. The items in the collection view are
> "stories" with size around 100x100. To begin with, I prepopulate the
> underlying datastore and things are great, I've got 2, 3 or 4 stories in
> each column. Dragging around works just as expected.
>
> In my case, a column is a SECTION. A 4 column board then has 4 sections.
>
> Problem: if I move ALL the items out of a column (a column is a SECTION)
> ... I can't move anything back INTO the column (section). I don't think the
> SECTION has any HEIGHT if it has no items ... and consequently, dragging a
> "story" item over the area that represents a column does nothing because
> the CollectionView doesn't actually create anything there if I have at 0
> item layoutAttributes for that section.
>
> Is there a specific way to do this? I still have a supplementary view as
> the column header and it always appears ... and in a UITableView, I think,
> if I have a empty section but have a section header, the built in move
> functionality will allow me to drag an item over the section header and
> allow me to drop into the section (but I can't remember if this is true)
> --- but dragging an "story" item over the supplementary view does nothing.
>
> In the worst case, do I need to keep some sort of hidden item as the first
> element? I take all "stories" out of a column (section), should I put at
> least one, invisible item in the column (section) to keep it available as a
> drag target?
>
> Hope that makes sense - I tend to be wordy.
>
> Thanks,
> -Luther
>
>
>
> On Tue, Mar 8, 2016 at 12:05 AM, Luther Baker <lutherba...@gmail.com>
> wrote:
>
>> Now we're cooking with GAS!!!
>>
>> override func applyLayoutAttributes(layoutAttributes:
>> UICollectionViewLayoutAttributes) {
>> print("apply layout attributes!: \(titleLabel.text)")
>> }
>>
>> Thanks Man!
>> -Luther
>>
>>
>>
>> On Mon, Mar 7, 2016 at 11:54 PM, Luke Hiesterman <luket...@apple.com>
>> wrote:
>>
>>> By teaching a cell to respond to an attribute I merely meant that it
>>> should override setLayoutAttributes: and do something in there with the
>>> relevant property. Hope that helps.
>>>
>>> Luke
>>>
>>> On Mar 7, 2016, at 9:39 PM, Luther Baker <lutherba...@gmail.com> wrote:
>>>
>>> > teach your cell classes to respond to that property
>>>
>>> Want to think about this out loud. Wondering what would 'trigger' a
>>> lookup on the layout's layoutAttributesForItemAtIndexPath ... and where
>>> would I store the indexPath I am dragging around.
>>>
>>> If I were to be more literal - in my view controller, I handle the
>>> UIGestureRecognizerState.Began event. At this point, I can get the
>>> indexPath of the element I am about to move and if I change something on
>>> that cell at that time, it sticks for the life of the drag without
>>> reference to layoutAttributes. I also handle the
>>> UIGestureRecognizerState.Changed event and again, if I retrieve the cell at
>>> the gesture's locationInView and change things in it ... those changes
>>> stick until I let go of the drag.
>>>
>>> Stepping into the custom layout for a minute ... as you suggested, I am
>>> now implementing layoutAttributesForInteractivelyMovingItemAtIndexPath ...
>>> and that is getting invoked in response to the
>>> updateInteractiveMovementTargetPosition call I am making as the gesture
>>> location changes. Now, I know the collection view's methods are triggering
>>> the layout's callbacks - but I'm not sure what would trigger me to fetch
>>> the custom attributes you are suggesting. At a minimum, to ask the layout
>>> for the attributes at that indexPath, I'd have to 

Re: UICollectionView Moving

2016-03-09 Thread Luther Baker
Ok - I think this is the final question.

I've created a layout that is essentially a bunch of ragged bottom columns
- like a Trello or Kanban board. The items in the collection view are
"stories" with size around 100x100. To begin with, I prepopulate the
underlying datastore and things are great, I've got 2, 3 or 4 stories in
each column. Dragging around works just as expected.

In my case, a column is a SECTION. A 4 column board then has 4 sections.

Problem: if I move ALL the items out of a column (a column is a SECTION)
... I can't move anything back INTO the column (section). I don't think the
SECTION has any HEIGHT if it has no items ... and consequently, dragging a
"story" item over the area that represents a column does nothing because
the CollectionView doesn't actually create anything there if I have at 0
item layoutAttributes for that section.

Is there a specific way to do this? I still have a supplementary view as
the column header and it always appears ... and in a UITableView, I think,
if I have a empty section but have a section header, the built in move
functionality will allow me to drag an item over the section header and
allow me to drop into the section (but I can't remember if this is true)
--- but dragging an "story" item over the supplementary view does nothing.

In the worst case, do I need to keep some sort of hidden item as the first
element? I take all "stories" out of a column (section), should I put at
least one, invisible item in the column (section) to keep it available as a
drag target?

Hope that makes sense - I tend to be wordy.

Thanks,
-Luther



On Tue, Mar 8, 2016 at 12:05 AM, Luther Baker <lutherba...@gmail.com> wrote:

> Now we're cooking with GAS!!!
>
> override func applyLayoutAttributes(layoutAttributes:
> UICollectionViewLayoutAttributes) {
> print("apply layout attributes!: \(titleLabel.text)")
> }
>
> Thanks Man!
> -Luther
>
>
>
> On Mon, Mar 7, 2016 at 11:54 PM, Luke Hiesterman <luket...@apple.com>
> wrote:
>
>> By teaching a cell to respond to an attribute I merely meant that it
>> should override setLayoutAttributes: and do something in there with the
>> relevant property. Hope that helps.
>>
>> Luke
>>
>> On Mar 7, 2016, at 9:39 PM, Luther Baker <lutherba...@gmail.com> wrote:
>>
>> > teach your cell classes to respond to that property
>>
>> Want to think about this out loud. Wondering what would 'trigger' a
>> lookup on the layout's layoutAttributesForItemAtIndexPath ... and where
>> would I store the indexPath I am dragging around.
>>
>> If I were to be more literal - in my view controller, I handle the
>> UIGestureRecognizerState.Began event. At this point, I can get the
>> indexPath of the element I am about to move and if I change something on
>> that cell at that time, it sticks for the life of the drag without
>> reference to layoutAttributes. I also handle the
>> UIGestureRecognizerState.Changed event and again, if I retrieve the cell at
>> the gesture's locationInView and change things in it ... those changes
>> stick until I let go of the drag.
>>
>> Stepping into the custom layout for a minute ... as you suggested, I am
>> now implementing layoutAttributesForInteractivelyMovingItemAtIndexPath ...
>> and that is getting invoked in response to the
>> updateInteractiveMovementTargetPosition call I am making as the gesture
>> location changes. Now, I know the collection view's methods are triggering
>> the layout's callbacks - but I'm not sure what would trigger me to fetch
>> the custom attributes you are suggesting. At a minimum, to ask the layout
>> for the attributes at that indexPath, I'd have to actually be tracking the
>> 'selectedIndexPath' in which case, I could just get the cell and modify it
>> directly.
>>
>> I guess I'm wondering how to "teach my cells classes to respond to that
>> property" ... Cells are reused so I'm not even sure how I'd go about
>> setting up and tearing down a KVO type relationship for the specific cell I
>> am dragging around. Maybe there is a WWDC video that digs into this? or
>> it's an easy explain?
>>
>> Sorry for being so long-winded. I'm not sure I'm communicating my
>> question well. Hope you can understand my underlying question and nudge me
>> the right way but at any rate, thanks for your help so far. I'd love to use
>> an elegant, "made for CollectionView" solution ... but I don't think I'm
>> looking at it correctly yet. Just in general I guess, how can a change to
>> the layoutAttributes cause my CollectionViewDelegate and DataSources to
>> fetch the cell I'm dragging around and

Re: UICollectionView Moving

2016-03-07 Thread Luther Baker
Now we're cooking with GAS!!!

override func applyLayoutAttributes(layoutAttributes:
UICollectionViewLayoutAttributes) {
print("apply layout attributes!: \(titleLabel.text)")
}

Thanks Man!
-Luther



On Mon, Mar 7, 2016 at 11:54 PM, Luke Hiesterman <luket...@apple.com> wrote:

> By teaching a cell to respond to an attribute I merely meant that it
> should override setLayoutAttributes: and do something in there with the
> relevant property. Hope that helps.
>
> Luke
>
> On Mar 7, 2016, at 9:39 PM, Luther Baker <lutherba...@gmail.com> wrote:
>
> > teach your cell classes to respond to that property
>
> Want to think about this out loud. Wondering what would 'trigger' a lookup
> on the layout's layoutAttributesForItemAtIndexPath ... and where would I
> store the indexPath I am dragging around.
>
> If I were to be more literal - in my view controller, I handle the
> UIGestureRecognizerState.Began event. At this point, I can get the
> indexPath of the element I am about to move and if I change something on
> that cell at that time, it sticks for the life of the drag without
> reference to layoutAttributes. I also handle the
> UIGestureRecognizerState.Changed event and again, if I retrieve the cell at
> the gesture's locationInView and change things in it ... those changes
> stick until I let go of the drag.
>
> Stepping into the custom layout for a minute ... as you suggested, I am
> now implementing layoutAttributesForInteractivelyMovingItemAtIndexPath ...
> and that is getting invoked in response to the
> updateInteractiveMovementTargetPosition call I am making as the gesture
> location changes. Now, I know the collection view's methods are triggering
> the layout's callbacks - but I'm not sure what would trigger me to fetch
> the custom attributes you are suggesting. At a minimum, to ask the layout
> for the attributes at that indexPath, I'd have to actually be tracking the
> 'selectedIndexPath' in which case, I could just get the cell and modify it
> directly.
>
> I guess I'm wondering how to "teach my cells classes to respond to that
> property" ... Cells are reused so I'm not even sure how I'd go about
> setting up and tearing down a KVO type relationship for the specific cell I
> am dragging around. Maybe there is a WWDC video that digs into this? or
> it's an easy explain?
>
> Sorry for being so long-winded. I'm not sure I'm communicating my question
> well. Hope you can understand my underlying question and nudge me the right
> way but at any rate, thanks for your help so far. I'd love to use an
> elegant, "made for CollectionView" solution ... but I don't think I'm
> looking at it correctly yet. Just in general I guess, how can a change to
> the layoutAttributes cause my CollectionViewDelegate and DataSources to
> fetch the cell I'm dragging around and change it (or does it not require
> the delegates or datasources ... ?)
>
> Thanks,
> -Luther
>
>
>
> On Mon, Mar 7, 2016 at 2:45 PM, Luke Hiesterman <luket...@apple.com>
> wrote:
>
>> You can create your own subclass of UICollectionViewLayoutAttributes and
>> add something like an “isMoving” property to that. Then teach your cell
>> classes to respond to that property by changing the background color.
>>
>> Luke
>>
>> On Mar 7, 2016, at 11:44 AM, Luther Baker <lutherba...@gmail.com> wrote:
>>
>> Thanks Luke! That was it - I can drag and drop successfully now.
>>
>> One more question, how do I modify a property of the item I'm dragging
>> around if the property is NOT currently in UICollectionViewLayoutAttributes
>> ... I don't see a call to the datasource or delegate when I select the cell
>> for moving ... so I'm not sure how to change the background color to "red"
>> for instance.
>>
>> Would I have to add my own view to the superview and manually move it
>> around in the dragging callbacks?
>>
>> Thanks!
>> -Luther
>>
>>
>> On Mon, Mar 7, 2016 at 11:59 AM, Luke Hiesterman <luket...@apple.com>
>> wrote:
>>
>>> I’d check your return value for this method in your layout:
>>>
>>> - (UICollectionViewLayoutAttributes
>>> *)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath
>>> *)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);
>>>
>>> Luke
>>>
>>> On Mar 7, 2016, at 9:55 AM, Luther Baker <lutherba...@gmail.com> wrote:
>>>
>>> I followed the directions here,
>>>
>>> http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
>>> - to add iOS9 style dragging

Re: UICollectionView Moving

2016-03-07 Thread Luther Baker
> teach your cell classes to respond to that property

Want to think about this out loud. Wondering what would 'trigger' a lookup
on the layout's layoutAttributesForItemAtIndexPath ... and where would I
store the indexPath I am dragging around.

If I were to be more literal - in my view controller, I handle the
UIGestureRecognizerState.Began event. At this point, I can get the
indexPath of the element I am about to move and if I change something on
that cell at that time, it sticks for the life of the drag without
reference to layoutAttributes. I also handle the
UIGestureRecognizerState.Changed event and again, if I retrieve the cell at
the gesture's locationInView and change things in it ... those changes
stick until I let go of the drag.

Stepping into the custom layout for a minute ... as you suggested, I am now
implementing layoutAttributesForInteractivelyMovingItemAtIndexPath ... and
that is getting invoked in response to the
updateInteractiveMovementTargetPosition call I am making as the gesture
location changes. Now, I know the collection view's methods are triggering
the layout's callbacks - but I'm not sure what would trigger me to fetch
the custom attributes you are suggesting. At a minimum, to ask the layout
for the attributes at that indexPath, I'd have to actually be tracking the
'selectedIndexPath' in which case, I could just get the cell and modify it
directly.

I guess I'm wondering how to "teach my cells classes to respond to that
property" ... Cells are reused so I'm not even sure how I'd go about
setting up and tearing down a KVO type relationship for the specific cell I
am dragging around. Maybe there is a WWDC video that digs into this? or
it's an easy explain?

Sorry for being so long-winded. I'm not sure I'm communicating my question
well. Hope you can understand my underlying question and nudge me the right
way but at any rate, thanks for your help so far. I'd love to use an
elegant, "made for CollectionView" solution ... but I don't think I'm
looking at it correctly yet. Just in general I guess, how can a change to
the layoutAttributes cause my CollectionViewDelegate and DataSources to
fetch the cell I'm dragging around and change it (or does it not require
the delegates or datasources ... ?)

Thanks,
-Luther



On Mon, Mar 7, 2016 at 2:45 PM, Luke Hiesterman <luket...@apple.com> wrote:

> You can create your own subclass of UICollectionViewLayoutAttributes and
> add something like an “isMoving” property to that. Then teach your cell
> classes to respond to that property by changing the background color.
>
> Luke
>
> On Mar 7, 2016, at 11:44 AM, Luther Baker <lutherba...@gmail.com> wrote:
>
> Thanks Luke! That was it - I can drag and drop successfully now.
>
> One more question, how do I modify a property of the item I'm dragging
> around if the property is NOT currently in UICollectionViewLayoutAttributes
> ... I don't see a call to the datasource or delegate when I select the cell
> for moving ... so I'm not sure how to change the background color to "red"
> for instance.
>
> Would I have to add my own view to the superview and manually move it
> around in the dragging callbacks?
>
> Thanks!
> -Luther
>
>
> On Mon, Mar 7, 2016 at 11:59 AM, Luke Hiesterman <luket...@apple.com>
> wrote:
>
>> I’d check your return value for this method in your layout:
>>
>> - (UICollectionViewLayoutAttributes
>> *)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath
>> *)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);
>>
>> Luke
>>
>> On Mar 7, 2016, at 9:55 AM, Luther Baker <lutherba...@gmail.com> wrote:
>>
>> I followed the directions here,
>>
>> http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
>> - to add iOS9 style dragging to my UICollectionView - and it sort of
>> works.
>>
>> As described in the article, I added a long press gesture recognizer and
>> wired it in to make calls on the collection view -- but now, if I long
>> press, the element under my finger disappears. As I drag the transparent
>> image around, the other elements shift - but I can never see the element I
>> am dragging around. When I let go, there is simply a hole left where I
>> "dropped" the element.
>>
>> I do, very much, have a custom layout and I'm not sure that if, for drag,
>> I
>> need to do anything special. Do I need to calculate the frame of the item
>> I
>> am dragging around? I'm not sure what to try next except to roll my own
>> dragging. Any thoughts or things to try?
>>
>> Thanks in advance.
>> ___
>>
>> Cocoa-de

Re: UICollectionView Moving

2016-03-07 Thread Luther Baker
Thanks Luke! That was it - I can drag and drop successfully now.

One more question, how do I modify a property of the item I'm dragging
around if the property is NOT currently in UICollectionViewLayoutAttributes
... I don't see a call to the datasource or delegate when I select the cell
for moving ... so I'm not sure how to change the background color to "red"
for instance.

Would I have to add my own view to the superview and manually move it
around in the dragging callbacks?

Thanks!
-Luther


On Mon, Mar 7, 2016 at 11:59 AM, Luke Hiesterman <luket...@apple.com> wrote:

> I’d check your return value for this method in your layout:
>
> - (UICollectionViewLayoutAttributes
> *)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath
> *)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);
>
> Luke
>
> On Mar 7, 2016, at 9:55 AM, Luther Baker <lutherba...@gmail.com> wrote:
>
> I followed the directions here,
>
> http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
> - to add iOS9 style dragging to my UICollectionView - and it sort of works.
>
> As described in the article, I added a long press gesture recognizer and
> wired it in to make calls on the collection view -- but now, if I long
> press, the element under my finger disappears. As I drag the transparent
> image around, the other elements shift - but I can never see the element I
> am dragging around. When I let go, there is simply a hole left where I
> "dropped" the element.
>
> I do, very much, have a custom layout and I'm not sure that if, for drag, I
> need to do anything special. Do I need to calculate the frame of the item I
> am dragging around? I'm not sure what to try next except to roll my own
> dragging. Any thoughts or things to try?
>
> 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/luketheh%40apple.com
>
> This email sent to luket...@apple.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

UICollectionView Moving

2016-03-07 Thread Luther Baker
I followed the directions here,
http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
- to add iOS9 style dragging to my UICollectionView - and it sort of works.

As described in the article, I added a long press gesture recognizer and
wired it in to make calls on the collection view -- but now, if I long
press, the element under my finger disappears. As I drag the transparent
image around, the other elements shift - but I can never see the element I
am dragging around. When I let go, there is simply a hole left where I
"dropped" the element.

I do, very much, have a custom layout and I'm not sure that if, for drag, I
need to do anything special. Do I need to calculate the frame of the item I
am dragging around? I'm not sure what to try next except to roll my own
dragging. Any thoughts or things to try?

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/archive%40mail-archive.com

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

Re: Starting out with storyboards (on Mac)

2016-03-05 Thread Luther Baker
Thanks for posting those great references Bill!

Luther
On Sat, Mar 5, 2016 at 1:04 PM Bill Cheeseman  wrote:

>
> > On Mar 5, 2016, at 1:35 PM, Gary L. Wade 
> wrote:
> >
> > On Mar 2, 2016, at 11:20 AM, Bill Cheeseman  > wrote:
> >
> >> Broadening my horizons is *always* one of my purposes.
> >
> > Sounds like your book will be getting a sequel by the end of it? Swift
> Cocoa Recipes for Apple Platforms?
>
>
> No, my book writing days are over and done with. I do occasionally think
> about a blog for the little things I learn how to do every day. Something
> much less in-depth than "Friday Q" or the like, but still suitable for
> helping people find solutions via Google. "Vermont Snippets," maybe.
>
> But then I kick myself and wake up. These days, I just want to write good
> code, especially if it's doing something I've never done before.
>
> --
>
> Bill Cheeseman - wjcheese...@comcast.net
>
> ___
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: Starting out with storyboards (on Mac)

2016-03-01 Thread Luther Baker
> But where does the default one come from?

Here are some steps for an iOS project - maybe it will be in the same area.

Select and open the storyboard in the IDE. Find the View Controller scene
you think is showing up by default. Open the scene (click the arrow) and
select the actual view controller beneath it. Then, look to your right in
the property pane and select the the Attributes selector (it looks like a
downward arrow). It is just to the right of the newspaper looking icon and
to the left of the ruler.

The first section you'll see will be titled "Simulated Metrics" ... the
second section will be titled "View Controller". The first field in "View
Controller will be "Title" and just under that you will see a checkbox that
says:

"Is initial View Controller"

A check-mark here generally identifies the initial view controller. Again,
this is iOS and I understand your question was for OSX. My apologies if
this is just noise.

Thanks,
-Luther




On Tue, Mar 1, 2016 at 4:06 PM, Jerry Krinock  wrote:

>
> > On 2016 Mar 01, at 10:06, Quincey Morris <
> quinceymor...@rivergatesoftware.com> wrote:
> >
> > open TextEdit, open the storyboard, and choose File -> Revert To Saved
> -> Browse All Versions…
>
> Very cool.  I never realized that the Versions Browser would work across
> the edge case of document types (a text file, in this case) which can be
> edited by different apps.
>
>
> ___
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: Using AppDelegate as an app-wide singleton

2015-12-01 Thread Luther Baker
The conversation here is pretty loose ... and so everyone might be right in
what they are intending to convey... ;-) but I thought I'd just put in a
vote to stop using the term "Singleton" for this access pattern. It isn't a
Singleton (unless there is historical signficance that grandfathers this
incorrect term in) and I think that using the term loosely in this case
actually weakens the power of a pattern vocabulary a bit.

Unless you're doing something we can't see (which is possible), it is
unlikely you are actually creating a Singleton. It is more likely that you
are creating class methods that in some/many/most/all cases - are accessing
private static instances. Similar in form to ...

[NSUserDefaults standardUserDefaults]
[NSNotificationCenter defaultCenter]

Neither NSApplication, NSUserDefaults nor NSNotificationCenter technically
adhere to the Singleton pattern -- although everyone labels this technique
as such.

https://en.wikipedia.org/wiki/Singleton_pattern

Alex, the API uses lots of different words to grab a-hold of the so-called
"standard", "default" or "shared" static instance. Unfortunately, I'm not
aware of any docs that specify when to use which adjective or if any one
particular adjective should be used when creating a real Singleton ...
since none of these are!

That said, the names all seem contextually valid ... and yet completely
ignore the idea of reflecting their identical access pattern.

Maybe someone can chime in with some historical context. There are better
ways to implement/approximate real Singletons ... they just aren't obvious
(and may not be necessary)  aand, this line of conversation is
probably getting dry by now ;-) Happy to hear someone chime in on this
perspective!

Cheers,
-Luther



On Tue, Dec 1, 2015 at 9:15 PM, Alex Zavatone  wrote:

> What does Apple do on this?
>
> I think their standard is to use shared in the name.
>
>
> On Dec 1, 2015, at 7:33 PM, Quincey Morris <
> quinceymor...@rivergatesoftware.com> wrote:
>
> > On Dec 1, 2015, at 16:20 , Carl Hoefs 
> wrote:
> >
> >> The following seems to be working out for me.
> >>
> >> #import "AppCommon.h"
> >> @implementation AppCommon
> >> + (AppCommon *)shared
> >> {
> >>static AppCommon *shared = nil;
> >>static dispatch_once_t token;
> >>dispatch_once(, ^{
> >>shared = [[self alloc] init];
> >>});
> >>return shared;
> >> }
> >
> > Looks functionally perfect.
> >
> > PSA #1: I would encourage you avoid naming the method ‘shared’, indeed
> to avoid naming anything with a brief name that doesn’t say what it is.
> Even the argument that it’s easier to type isn’t good any more, since Xcode
> is going to autocomplete almost every name for you.
> >
> > PSA #2: I can’t help mentioning that you can write all of this in Swift
> as so:
> >
> >   class AppCommon {
> >   static let shared = AppCommon ()
> >   }
> >
> > Sometimes, Swift really is Obj-C-but-better. ;)
> >
> > ___
> >
> > 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/zav%40mac.com
> >
> > This email sent to z...@mac.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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: Auto Layout Problems

2015-09-04 Thread Luther Baker
I may not be following the entire thread very well - but as you likely
know, with autolayout, the scrollview's content size is literally
determined by its contents. It is generally simple to bind the scrollview
edges to the parent you mention but I think your next step is to properly
size the Stack View ... (child view) so that the ScrollView knows how big
to make it's content view.

On iOS, I can set width and height constraints between the child view and
its parent ScrollView's frame ... telling the child view to be the same
width and height as the ScrollView's frame. Note that these constraints are
not associated with the ScrollView's content view. Indeed, they drive the
content view's size. Think of it as the content view "reaching back" and
finding out how big it should be by constraining to sizes up the hierarchy.

I assume that model ports over to MacOS ... but I could be wrong.

Also, I'm guessing this bulletin was presented earlier but if not
https://developer.apple.com/library/ios/technotes/tn2154/_index.html

HTH,
-Luther




On Fri, Sep 4, 2015 at 12:48 PM, Dave  wrote:

> Hi,
>
> > It seems your thread keeps changing subjects so it's been difficult to
> follow your troubles back to something at the start, or maybe something's
> gotten lost.
>
>
> What I’d dearly love to know right now is how to setup the Constraints for
> a Scroll View and Clip View etc. in XCode/IB for Mac.
>
> If I have a window in a NIB like this:
>
> Window  Initially
> - Width=846, Height=594
> View
> ScrollView  Initially
> - X=20,Y=20, Width=806, Height=554
> Flipped Clip View
> View
>
> How do I set the constraints for the above Views in XCode/IB?
>
> I want the Scroll View to Stretch/Contract if the window is resized.
>
> After this, I’d like to add a StackView to the Scroll View (in XCode/IB)
> and have it Match the Size/Position of the Scroll View.
>
> I’ve found (sketchy) articles describing how to it in XCode/IB for iOS and
> I’’ve found (again sketchy) an article how to do it in Code for Mac.
>
> Ideally I’d like to be able to do this and target 10.9 and using XCode 6.4.
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: Collection Views Breaking

2015-05-21 Thread Luther Baker
Thanks for digging in and tracking that down Bill! Very much appreciated!
It actually makes sense with what I'm now reading about Collection Views.

And thanks Kyle. I've seen that breakpoint behavior before and just dealt
with it ... but your statement about hardware exceptions really clarifies
it succinctly.

-Luther

On Wed, May 20, 2015 at 3:24 PM, Bill Monk billm...@mac.com wrote:

 That's crashing because after going back, FirstViewController is using
 SecondViewController as it's collectionView's delegate  dataSource,
 resulting in messages to a dealloc-ed object. Turn on NSZombies to see this.

 This appears to happen because when going Back from your
 SecondViewController's, FirstViewController is using SecondViewController
 as its collection view's delegate / dataSource. Note that if you make a
 strong reference to SecondViewController someone, so it isn't dealloced,
 FirstViewController will start drawing its content using
 SecondViewController's colors via SecondViewController's
 cellForItemAtIndexPath.

 One way to fix that is to add, in both view controllers:

 - (void)viewWillAppear:(BOOL)animated  {
 self.collectionView.delegate = self;
 self.collectionView.dataSource = self;
 }

 Also good practice to do:

 - (void)dealloc
 {
 self.collectionView.delegate = nil;
 self.collectionView.dataSource = nil;
 }

 That lets it run OK, but I'm not sure *why* your FirstViewController ends
 up using Second as its delegate. The project doesn't contain any code that
 directly does that. So I can't tell if the -viewWillAppear above is a
 Band-Aid, or a correct solution. Perhaps it is with
 useLayoutToLayoutNavigationTransitions? I haven't used that before.

 Anyway that should get you started.

 On May 20, 2015, at 7:45 AM, cocoa-dev-requ...@lists.apple.com wrote:

 
  --
 
  Message: 1
  Date: Tue, 19 May 2015 23:46:28 -0500
  From: Luther Baker lutherba...@gmail.com
  To: Cocoa Developers Cocoa-dev@lists.apple.com
  Subject: Collection Views Breaking
  Message-ID:

 cal5mv1m-u82zgvr6uacgy+9avn-cc1uo6++xvcfot7sd8qu...@mail.gmail.com
  Content-Type: text/plain; charset=UTF-8
 
  I've got a simple iOS project consisting of 2 collection view controllers
  and a navigation controller.
 
  Tapping any item in the first collection view simply pushes the second
  collection view on the stack.
 
  Problem is, when I tap  Back and then manually scroll up ... the app
  crashes with a EXC_BAD_ACCESS error in main.
 
  Nothing is logged ... and the stack in the thread looks something like
 
  0 objc_msgSend
  16 UIApplicationMain
  17 main
  18 start
  19 start
 
  with 17 main highlighted.
 
  /
 
  In the code, FirstViewController and SecondViewController are almost
  identical save for one line. I am specifically looking at what line 24 in
  SecondViewController does to the push transition.
 
 self.useLayoutToLayoutNavigationTransitions = YES;
 
  Upon running, the collection view push animation looks fine - and the
 
  Back button actually works ... but once I get back to
 FirstViewController,
  the original colors never come back. In addition, when I scroll up, I get
  the error listed above.
 
  I've thrown together a small project to demonstrate:
  https://github.com/LutherBaker/CollectionViewDemo
 
  Thoughts? It feels like I'm not referencing something I should be ...
 
  Thanks,
  -Luther
 
  PS: I think you may ignore this but note that when you initially select
 an
  item in the FirstViewController and push - the console spits lots and
  lots of
 
  *Snapshotting a view that has not been rendered results in an empty
  snapshot. Ensure your view has been rendered at least once before
  snapshotting or snapshot after screen updates.*
  which I assume is simply a bug or non-relevant logging accidentally left
 in
  the framework.
 


___

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: Collection Views Breaking

2015-05-20 Thread Luther Baker
Thanks Alex,

I have set an exception breakpoint but it never fires - and I will
experiment with popping the second view controller programmatically and
scrolling up.

I think this has to do with my elementary understanding of how
UICollectionViews are reused in this type of transition animation - I've
learned, for instance, that the datasource isn't actually changing (as part
of useLayoutToLayoutNavigationTransitions).

A tangental point I'm better understanding is that this property really
just causes collection view controller push transitions to use the 'pushed'
controller's layout ... (ie: the datasource is ignored).

For example, tapping on a particular picture in a grid and pushing a new
collection view controller on the stack might not actually change the
existing picture data but does potentially reflow the layout - like, could
make the selected picture huge. Yes, I am thinking that is probably the
purpose of setting this particular property.

Thanks again for looking and replying!
-Luther



On Wed, May 20, 2015 at 11:42 AM, Alex Zavatone z...@mac.com wrote:

 What if you issue the back programatically and then scroll up?

 It would be interesting to see just what gets unwired here.

 Have you set an exception breakpoint to tell you exactly what is breaking?

 On May 20, 2015, at 12:46 AM, Luther Baker wrote:

  I've got a simple iOS project consisting of 2 collection view controllers
  and a navigation controller.
 
  Tapping any item in the first collection view simply pushes the second
  collection view on the stack.
 
  Problem is, when I tap  Back and then manually scroll up ... the app
  crashes with a EXC_BAD_ACCESS error in main.
 
  Nothing is logged ... and the stack in the thread looks something like
 
  0 objc_msgSend
  16 UIApplicationMain
  17 main
  18 start
  19 start
 
  with 17 main highlighted.
 
  /
 
  In the code, FirstViewController and SecondViewController are almost
  identical save for one line. I am specifically looking at what line 24 in
  SecondViewController does to the push transition.
 
 self.useLayoutToLayoutNavigationTransitions = YES;
 
  Upon running, the collection view push animation looks fine - and the
 
  Back button actually works ... but once I get back to
 FirstViewController,
  the original colors never come back. In addition, when I scroll up, I get
  the error listed above.
 
  I've thrown together a small project to demonstrate:
  https://github.com/LutherBaker/CollectionViewDemo
 
  Thoughts? It feels like I'm not referencing something I should be ...
 
  Thanks,
  -Luther
 
  PS: I think you may ignore this but note that when you initially select
 an
  item in the FirstViewController and push - the console spits lots and
  lots of
 
  *Snapshotting a view that has not been rendered results in an empty
  snapshot. Ensure your view has been rendered at least once before
  snapshotting or snapshot after screen updates.*
  which I assume is simply a bug or non-relevant logging accidentally left
 in
  the framework.
  ___
 
  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/zav%40mac.com
 
  This email sent to z...@mac.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

Collection Views Breaking

2015-05-19 Thread Luther Baker
I've got a simple iOS project consisting of 2 collection view controllers
and a navigation controller.

Tapping any item in the first collection view simply pushes the second
collection view on the stack.

Problem is, when I tap  Back and then manually scroll up ... the app
crashes with a EXC_BAD_ACCESS error in main.

Nothing is logged ... and the stack in the thread looks something like

0 objc_msgSend
16 UIApplicationMain
17 main
18 start
19 start

with 17 main highlighted.

/

In the code, FirstViewController and SecondViewController are almost
identical save for one line. I am specifically looking at what line 24 in
SecondViewController does to the push transition.

self.useLayoutToLayoutNavigationTransitions = YES;

Upon running, the collection view push animation looks fine - and the 
Back button actually works ... but once I get back to FirstViewController,
the original colors never come back. In addition, when I scroll up, I get
the error listed above.

I've thrown together a small project to demonstrate:
https://github.com/LutherBaker/CollectionViewDemo

Thoughts? It feels like I'm not referencing something I should be ...

Thanks,
-Luther

PS: I think you may ignore this but note that when you initially select an
item in the FirstViewController and push - the console spits lots and
lots of

*Snapshotting a view that has not been rendered results in an empty
snapshot. Ensure your view has been rendered at least once before
snapshotting or snapshot after screen updates.*
which I assume is simply a bug or non-relevant logging accidentally left in
the framework.
___

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: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-06 Thread Luther Baker
On Wed, May 6, 2015 at 11:54 AM, Jens Alfke j...@mooseyard.com wrote:


  On May 6, 2015, at 8:36 AM, Uli Kusterer witness.of.teacht...@gmx.net
 wrote:
 
  So you're not setting a constraint on the *document* view? How do you
 expect it to know how to constrain that view otherwise?

 The size of the document view is fundamentally unrelated to the size of
 the clip or scroll view — the whole point of having a scroll view is that
 you have an arbitrarily large document! So I wouldn’t expect the scroll
 view to be trying to constrain the size of the document view at all. The
 app code is in charge of deciding how big the document view is, based on
 the content it displays.


I'm probably missing something ... but fundamentally, the whole point of
constraints between the scrollview and its children is so that the
scrollview knows how big to make its contentSize. It sounds like you've got
this flipped ... the scrollview is not trying to constrain the size of the
document at all - when using autolayout, the scrollview is dynamically
trying to determine it's *own* contentSize. I know you skipped that report
I sent you - but by doing so, I think you're missing some helpful insight.
You post sounds like you're just frustrated it didn't just work in IB ...
and you're upset you've finally got to actually learn about this
new-fangled layout paradigm.


  IIRC you need to implement updateConstraints to create proper
 constraints, or intrinsicContentSize, or maybe both.

 I’ve never seen the intrinsicContentSize property before (partly because
 it’s not defined in NSView.h.)


This is Autolayout 101 stuff. 2013. Admittedly, maybe you're not doing much
iOS work ... but this was all part of the replacement for the UIView
sizeThatFits frame stuff. There an ecosystem here of how all this works
together.


 Reading the docs for it, it makes sense that I’d override it. And
 searching the docs for that name I found the “Auto Layout Guide”, which
 looks very useful but which I wouldn’t have found otherwise because I
 didn’t know to look for the keyword “auto layout” (everywhere else it’s
 called “constraints”…


Autolayout is not a new term :-) ... What do you mean everywhere ...
and what is its?

Take heart Jens! I'd suggest that it isn't quite as difficult as your
thread alludes to. It isn't an old timer thing either ... but it does take
some understanding and experimentation. Its an abstraction over frames. Its
a level of indirection ... and I'm am sorry that IB doesn't just handle it
automatically. Indeed there will be much gnashing of teeth going forward if
you really decide to dig in ... it is much more nuanced than literally
setting and tracking frames.

Just my $0.02. I thoroughly enjoy your contributions to this group and I'll
just say that this entire thread really surprised me. Hang in there! It
isn't that difficult!

Thanks,
-Luther



 —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/lutherbaker%40gmail.com

 This email sent to lutherba...@gmail.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: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Luther Baker
Not exactly the same but I found this doc helpful.

https://developer.apple.com/library/ios/technotes/tn2154/_index.html

Luther

 On May 5, 2015, at 7:58 PM, dangerwillrobinsondan...@gmail.com wrote:
 
 If you have AutoLayout on in a window it's actually on for all views. 
 NSScrollView and its hierarchy are a bit weird though. 
 Thing to do is create height and width constraints for the document view and 
 outlets  for them so you can configure them. If you're using 10.10+ you can 
 make them configurable in IB.   
 Then add a subview as your real document view. 
 
 For upper left corner origin you need to subclass NSClipView and return YES 
 from an override of isFlipped. 
 Set the class in IB for both. 
 You also want to uncheck the item for translatesAutoresizingMasks 
 If that doesn't appear in IB you can set it in code or just return NO from a 
 getter override. 
 
 Sent from my iPhone
 
 On 2015/05/06, at 1:26, Jens Alfke j...@mooseyard.com wrote:
 
 I haven't done much AppKit work in a while. Right now I have a small app 
 where I'm trying to do something very simple: put a custom NSView in a 
 window and make it scrollable. The view determines its own frame size based 
 on the content it needs to display. So all I did was create a new window in 
 IB, add an instance of my view, embed it in an NSScrollView, and set up 
 default constraints for the scroll view so it'll track the window size.
 
 It sort of works as long as the window is bigger than my custom view 
 (although the view is pinned to the bottom of the window instead of the top 
 for some reason.) But as soon as I resize the window to a height smaller 
 than the custom view's, the view disappears and never comes back.
 
 I added an override of -setFrame: and found that my view's frame is being 
 set to (0, 0, 0, 0) by AppKit while redisplaying the window. I have no idea 
 why this is happening ― it probably has something to do with constraints, 
 but I don't understand constraints well enough to know why (and I can't find 
 any clear documentation about how to use constraints with scroll views.) How 
 can I fix this?
 
 (OS X 10.10.4, Xcode 6.3.)
 
 ―Jens
 
 * thread #1: tid = 0x691af4, 0x00015c08 Hops`-[RevTreeView 
 setFrame:](self=0x61141600, _cmd=0x7fff8b0c9343, frame=(origin = 
 (x = 0, y = 0), size = (width = 0, height = 0))) + 24 at RevTreeView.m:70, 
 queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
 * frame #0: 0x00015c08 Hops`-[RevTreeView 
 setFrame:](self=0x61141600, _cmd=0x7fff8b0c9343, frame=(origin = 
 (x = 0, y = 0), size = (width = 0, height = 0))) + 24 at RevTreeView.m:70
   frame #1: 0x7fff9564628f AppKit`-[NSView resizeWithOldSuperviewSize:] 
 + 694
   frame #2: 0x7fff9574ce05 AppKit`-[NSView layoutSubtreeIfNeeded] + 810
   frame #3: 0x7fff95656e66 AppKit`-[NSView 
 _sendViewWillDrawInRect:clipRootView:] + 47
   frame #4: 0x7fff957fad04 AppKit`-[NSView 
 displayRectIgnoringOpacity:inContext:] + 362
   frame #5: 0x7fff959354cd AppKit`-[_NSMirrorDocumentView drawRect:] + 
 265
   frame #6: 0x7fff95676859 AppKit`-[NSView(NSInternal) 
 _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
  + 1186
   frame #7: 0x7fff95676278 AppKit`__46-[NSView(NSLayerKitGlue) 
 drawLayer:inContext:]_block_invoke + 218
   frame #8: 0x7fff95675f21 AppKit`-[NSView(NSLayerKitGlue) 
 _drawViewBackingLayer:inContext:drawingHandler:] + 2407
   frame #9: 0x7fff956755a3 AppKit`-[NSView(NSLayerKitGlue) 
 drawLayer:inContext:] + 108
   frame #10: 0x7fff958296c6 AppKit`-[_NSBackingLayerContents 
 drawLayer:inContext:] + 145
   frame #11: 0x7fff8a669ce7 QuartzCore`-[CALayer drawInContext:] + 119
   frame #12: 0x7fff958291fe AppKit`-[_NSTiledLayer drawTile:inContext:] 
 + 625
   frame #13: 0x7fff95828f2f AppKit`-[_NSTiledLayerContents 
 drawLayer:inContext:] + 169
   frame #14: 0x7fff8a669ce7 QuartzCore`-[CALayer drawInContext:] + 119
   frame #15: 0x7fff95828e70 AppKit`-[NSTileLayer drawInContext:] + 169
   frame #16: 0x7fff8a6683c7 QuartzCore`CABackingStoreUpdate_ + 3306
   frame #17: 0x7fff8a6676d7 
 QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 59
   frame #18: 0x7fff8a667694 QuartzCore`x_blame_allocations + 81
   frame #19: 0x7fff8a65b43c QuartzCore`CA::Layer::display_() + 1546
   frame #20: 0x7fff95828d87 AppKit`-[NSTileLayer display] + 119
   frame #21: 0x7fff956c2df4 AppKit`-[_NSTiledLayerContents update:] + 
 5688
   frame #22: 0x7fff956c14c7 AppKit`-[_NSTiledLayer display] + 375
   frame #23: 0x7fff8a6597fd 
 QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 603
   frame #24: 0x7fff8a658e81 
 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 35
   frame #25: 0x7fff8a658612 
 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 242
   frame #26: 0x7fff8a6583ae 

Re: how to slim down view controllers?

2015-04-01 Thread Luther Baker

 What's odd to me is that Apple preaches MVC, but then when we have the view 
 controller class, all to often the delegate is lumped into the same class,

Whoa, you're blaming Apple for this?

How is MVC, MVP or Apple forcing you to do this?

 fostering code bloat and sorta going against compartmentalization of tasks 
 (at least in my book it seems strange).

??? are you suggesting that how your code ends up is somehow not your 
responsibility?

I've seen a lot of complaints levied against Apple and product behaviors  but 
I've never seen someone complaining that Apple made them do it (put a 
delegate somewhere).

Massive View Controllers is a well-known anti-pattern. For one thing, it 
suggests you're not refactoring enough. Development 101 stuff. It is not 
anyone's fault but your own if you are bloating your view controllers. You 
still need to *think*


 Here's the link to the article I'm thinking about.
 
 http://www.objc.io/issue-1/lighter-view-controllers.html
 

Consider reading all the articles in issue 13. http://www.objc.io/issue-13

Take a look at reactive cocoa ... https://github.com/ReactiveCocoa/ReactiveCocoa

Dig into Martin Fowler's articles 
http://martinfowler.com/eaaDev/PresentationModel.html

And by all means, pick your fights with Apple wisely lest you blame them for 
everything. Development is hard work. At some point you've got to reflect on 
your own skills.

 Hope this helps.  Cheers,
 Alex Zavatone
 

-Luther

 
 On Apr 1, 2015, at 8:59 AM, Juan Felipe Alvarez Saldarriaga wrote:
 
 Hi,
 
 How you guys slim down your view controllers?, sometimes you end up 
 implementing a lot of protocols in your view controller, so there’s a lot of 
 code inside the controller itself. Reading about how to slim down view 
 controllers in iOS I found that a common way is to move DataSources 
 (http://www.objc.io/issue-1/lighter-view-controllers.html) to other class, 
 but what about other delegates?, or if you create views by code?. First, I 
 think about move each delegate to a NSObject class, so I try this:
 
 self.locationManager.delegate = 
 [[FRRYPetDescriptionViewControllerLocationDelegate alloc] init];
 
 Then I ask in IRC and somebody suggest categories, so this is what I got so 
 far:
 
 // FRRYPetDescriptionViewController.h
 @interface FRRYPetDescriptionViewController : UIViewController
 
 @property (nonatomic) CLLocationManager *locationManager;
 
 @property (nonatomic) TPKeyboardAvoidingScrollView *scrollView;
 @property (nonatomic) UIView *contentView;
 
 @end
 
 // FRRYPetDescriptionViewController+Protocols.h
 @interface FRRYPetDescriptionViewController (Protocols) UITextViewDelegate, 
 UIActionSheetDelegate, MFMailComposeViewControllerDelegate, 
 UIGestureRecognizerDelegate, MKMapViewDelegate, 
 UIViewControllerTransitioningDelegate, CLLocationManagerDelegate
 
 @end
 
 // FRRYPetDescriptionViewController+UIAdditions.h
 @interface FRRYPetDescriptionViewController (UIAdditions)
 
 - (void)createScrollView;
 - (void)createContentView;
 
 @end
 
 // FRRYPetDescriptionViewController+Callbacks.h
 @interface FRRYPetDescriptionViewController (Callbacks)
 
 @end
 
 // FRRYPetDescriptionViewController+LocationAdditions.h
 @interface FRRYPetDescriptionViewController (LocationAdditions)
 
 @end
 
 This makes me think, what about “private” methods?, do I need to declare all 
 properties in the view controller header file?. What you guys think about 
 this approach or there’s some common pattern to follow to not end with a fat 
 controller?.
 
 Thank you.
 
 --
 Juan Felipe Alvarez Saldarriaga
 http://juan.im
 Twitter: @nebiros
 Google Talk: nebi...@gmail.com
 Skype: jfasaldarriaga
 
 ___
 
 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/zav%40mac.com
 
 This email sent to z...@mac.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/lutherbaker%40gmail.com
 
 This email sent to lutherba...@gmail.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

Scrolling while resizing a UITableView with UITextFields

2015-03-21 Thread Luther Baker
Hi, I have a question about parallel scrolling (I think) in iOS.

Let's say I've got a UITableView with  20 or so rows where each cell's
contentView essentially contains a simple UITextField. Assume I am not
using a UITableViewController for the time being (I've actually got 5 of
these tableviews in a scrollview - setup like columns such that you can
page back and forth between them).

If I scroll to the bottom-most row of a particular tableview and tap on the
textfield, the keyboard comes up (Great!). I've setup keyboard handlers and
I'm resizing the tableview accordingly (Great!) ... and if I give it a
second or so, the row with the textfield I tapped on eventually scrolls up
and into view above the keyboard (Really Great!).

But ... I would like a slightly different animation. Instead of the
tableview shrinking such that the top rows stay put and the bottom rows
disappear ... with the bottom tapped textfield eventually scrolling up and
into view above the keyboard after the resizing is complete, *I want the
bottom set of rows to actually animate up* as I'm shrinking the tableview.
IE: the row that was tapped should never go out of view. I want the rows at
the top of the tableview to disappear as the tableview shrinks up.
Literally ... up.

Thoughts on how to approach this? Should I animate a contentOffset scroll
simultaneously?

Thanks,
-Luther
___

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: NSSplitView parallel motion

2014-11-09 Thread Luther Baker
FWIW ... achieved most of this by nesting split views and leveraging
autolayout constraints and priorities, almost no delegate code.

I'm still not sure how Mail pulls off the disappearing Source animation
though :-)

Thanks,
-Luther


On Sat, Nov 8, 2014 at 2:58 PM, Luther Baker lutherba...@gmail.com wrote:

 Is there a conventional way to implement parallel divider bar motion in
 an NSSplitView?

 While resizing a window, I get the general behavior I want by setting the
 holding properties of 3 view split view to 200, 250, 100 respectfully.
 While randomly resizing the view, the 3rd view collapses first, the first
 view follows leaving the 2nd view intact for the most part.

 But how to do this while dragging dividers around? Holding priorities
 don't work there and as soon as I start implementing split view delegate
 methods, the holding priorities start to not hold true.

 That said, I've tried doing this via delegate methods and gotten pretty
 far until the parallel movement thing (If you make the 1st view bigger, I
 want the 2nd view to move over and shrink the 3rd view) but when I try to
 use something like setPosition:maxXOfView0+300 ofDividerAtIndex:1 from
 within the splitView:constraintSplitView:ofSubviewAt - I get some sort of
 loopback effect and the first view jumps way up in size and things start
 flickering.

 - (CGFloat)splitView:(NSSplitView *)splitView

 constrainSplitPosition:(CGFloat)proposedPosition

  ofSubviewAt:(NSInteger)dividerIndex {

 if (dividerIndex == 0) {

 NSRect rect = _sourceContainerView.frame;

 CGFloat maxX = NSMaxX(rect);

 CGFloat position = maxX + 300;

 [splitView setPosition:position ofDividerAtIndex:1];

 }

 return proposedPosition;

 }

 Do I need to wait for something like splitViewDidResizeSubviews: and then
 manually move the divider bar or change the view's frame size?

 Also, I'm having pretty good luck simulating a collapse by simply
 setting the divider to 0 for something like the first view - but most of
 the online tutorials actually animate the view's frame to a size of 0.
 Which way is more correct? I don't know if I can animate the approach
 that directly sets the position of the divider bar.

 Finally then, Mail has an altogether different, neat effect when you
 collapse the first or Source view. If you notice, the second and third
 views appear to simply slide over the Source view. Maybe the Source view is
 getting smaller and auto layout is setup such that the labels don't shrink
 but it looks more like the 2nd and 3rd view are simply sliding over-on top
 of the Source view. And yes, the 2nd view isn't getting bigger, it is the
 3rd view that is getting the extra space.

 So, manual window resizing, dragging dividers around ... and programmatic
 buttons - all acting generally the same. In general, all resizing is done
 in the 3rd view ... and collapsing the 1st view has a special effect to it.

 Thanks in advance for any suggestions,
 -Luther



___

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

NSSplitView divider position

2014-11-08 Thread Luther Baker
Is there a direct way to determine the positions of the dividers in
NSSplitView. I'm implementing

splitView:additionalEffectiveRectOfDividerAtIndex:

and would like to create a rect relative to the current position of the
divider.

If not, are most people calculating this by adding the widths of all the
visible child/container views to the left of the divider index? (I've
noticed the the widths of collapsed views in the split view still have
the original size).

Also, it seems that the NSRect returned from this method is interpreted
more like an iOS rect ... that is, Y and the height seem to be top down and
not bottom up. Is that because the NSSplitView's internal coordinate system
is managed as such since the docs say ...

The rectangle should be expressed in the coordinate system defined by
*splitView*.

Thanks,
-Luther
___

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: NSSplitView divider position

2014-11-08 Thread Luther Baker
Thanks Ken.

On Sat, Nov 8, 2014 at 9:02 AM, Ken Thomases k...@codeweavers.com wrote:

 On Nov 8, 2014, at 8:19 AM, Luther Baker lutherba...@gmail.com wrote:

  Is there a direct way to determine the positions of the dividers in
  NSSplitView.

 No.

  If not, are most people calculating this by adding the widths of all the
  visible child/container views to the left of the divider index? (I've
  noticed the the widths of collapsed views in the split view still have
  the original size).

 Well, you can do that, although you also need to account for the
 dividerThickness for any intervening dividers.  You could also query the
 NSMaxY() or NSMaxX() of the preceding visible view.  (Actually, be careful
 of the user interface direction.  Vertical split views that use auto layout
 respect the user interface direction, so the views may be laid out right to
 left.)

  Also, it seems that the NSRect returned from this method is interpreted
  more like an iOS rect ... that is, Y and the height seem to be top down
 and
  not bottom up. Is that because the NSSplitView's internal coordinate
 system
  is managed as such since the docs say ...
 
  The rectangle should be expressed in the coordinate system defined by
  *splitView*.

 You should not assume either way.  You should either a) consult the
 -isFlipped method on the split view, or b) construct a rect in the
 coordinate system of one of your own views and then convert to the split
 view's coordinate system using [theSubview convertRect:theRect
 toView:theSplitView] or [theSplitView convertRect:theRect
 fromView:theSubView].

 Regards,
 Ken


___

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

NSSplitView parallel motion

2014-11-08 Thread Luther Baker
Is there a conventional way to implement parallel divider bar motion in
an NSSplitView?

While resizing a window, I get the general behavior I want by setting the
holding properties of 3 view split view to 200, 250, 100 respectfully.
While randomly resizing the view, the 3rd view collapses first, the first
view follows leaving the 2nd view intact for the most part.

But how to do this while dragging dividers around? Holding priorities don't
work there and as soon as I start implementing split view delegate methods,
the holding priorities start to not hold true.

That said, I've tried doing this via delegate methods and gotten pretty far
until the parallel movement thing (If you make the 1st view bigger, I want
the 2nd view to move over and shrink the 3rd view) but when I try to use
something like setPosition:maxXOfView0+300 ofDividerAtIndex:1 from within
the splitView:constraintSplitView:ofSubviewAt - I get some sort of loopback
effect and the first view jumps way up in size and things start flickering.

- (CGFloat)splitView:(NSSplitView *)splitView

constrainSplitPosition:(CGFloat)proposedPosition

 ofSubviewAt:(NSInteger)dividerIndex {

if (dividerIndex == 0) {

NSRect rect = _sourceContainerView.frame;

CGFloat maxX = NSMaxX(rect);

CGFloat position = maxX + 300;

[splitView setPosition:position ofDividerAtIndex:1];

}

return proposedPosition;

}

Do I need to wait for something like splitViewDidResizeSubviews: and then
manually move the divider bar or change the view's frame size?

Also, I'm having pretty good luck simulating a collapse by simply setting
the divider to 0 for something like the first view - but most of the online
tutorials actually animate the view's frame to a size of 0. Which way is
more correct? I don't know if I can animate the approach that directly
sets the position of the divider bar.

Finally then, Mail has an altogether different, neat effect when you
collapse the first or Source view. If you notice, the second and third
views appear to simply slide over the Source view. Maybe the Source view is
getting smaller and auto layout is setup such that the labels don't shrink
but it looks more like the 2nd and 3rd view are simply sliding over-on top
of the Source view. And yes, the 2nd view isn't getting bigger, it is the
3rd view that is getting the extra space.

So, manual window resizing, dragging dividers around ... and programmatic
buttons - all acting generally the same. In general, all resizing is done
in the 3rd view ... and collapsing the 1st view has a special effect to it.

Thanks in advance for any suggestions,
-Luther
___

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: Editing NSOutlineView Group Item

2014-11-07 Thread Luther Baker
http://openradar.appspot.com/18906942




On Wed, Nov 5, 2014 at 7:23 AM, Luther Baker lutherba...@gmail.com wrote:

 Thanks and thanks. I'll follow up on both your suggestions.

 Again, many thanks for your time Quincey!

 Luther


 On Nov 5, 2014, at 2:03 AM, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:

 On Nov 4, 2014, at 14:39 , Luther Baker lutherba...@gmail.com wrote:


 I've created a project on github that essentially duplicates the problem
 I'm having.

 $ git clone
 https://github.com/EffectiveProgramming/LBOutlineViewDemo.git


 I don’t see anything in it that should prevent the reload from working, so
 I don’t know what else to suggest except submit this project as a bug
 report.

 OTOH, based on the direction that you seem to be heading, I’d suggest you
 might do better to use bindings (from your table cell view subviews to the
 table cell view’s objectValue property, which would be set to the custom
 list item) and KVC to get the outline view to update, rather than using
 reload. That approach doesn’t answer the issue you’ve run into, but it
 might make it moot.


___

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: Editing NSOutlineView Group Item

2014-11-05 Thread Luther Baker
Thanks and thanks. I'll follow up on both your suggestions.

Again, many thanks for your time Quincey!

Luther


 On Nov 5, 2014, at 2:03 AM, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 On Nov 4, 2014, at 14:39 , Luther Baker lutherba...@gmail.com wrote:
 
 I've created a project on github that essentially duplicates the problem I'm 
 having.
 
 $ git clone https://github.com/EffectiveProgramming/LBOutlineViewDemo.git
 
 
 I don’t see anything in it that should prevent the reload from working, so I 
 don’t know what else to suggest except submit this project as a bug report.
 
 OTOH, based on the direction that you seem to be heading, I’d suggest you 
 might do better to use bindings (from your table cell view subviews to the 
 table cell view’s objectValue property, which would be set to the custom list 
 item) and KVC to get the outline view to update, rather than using reload. 
 That approach doesn’t answer the issue you’ve run into, but it might make it 
 moot.
 
___

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: Editing NSOutlineView Group Item

2014-11-04 Thread Luther Baker
I was hoping these changes would do it ... but unfortunately, I'm still
getting nothing 

You'll notice the logging below - I can confirm that the address of and
object *selected* is the exact same address of and object I am *reloading*.
Furthermore, the description logging from outlineViewSelectionDidChange:
prints out the old text and the description logging from
reloadSelectedIssue prints out the new text.

Unfortunately, outlineView:viewForTableColumn: is never invoked.

Thanks for the extended help Quincey,
-Luther


- (BOOL)outlineView:(NSOutlineView *)outlineView
isItemExpandable:(idPVOutlineViewItem)item {
return (item == nil);
}

- (void)outlineViewSelectionDidChange:(NSNotification *)notification {
NSOutlineView *outlineView = notification.object;
NSInteger selectedRow = outlineView.selectedRow;
_selectedItem = [outlineView itemAtRow:selectedRow];
NSLog(@selected item:(%@), self.selectedItem);
}

- (void)reloadSelectedIssue {
NSLog(@reload selected item: %@, _selectedItem);
[_outlineView reloadItem:_selectedItem reloadChildren:YES];
}


On Mon, Nov 3, 2014 at 11:55 AM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On Nov 3, 2014, at 04:12 , Luther Baker lutherba...@gmail.com wrote:


  Or perhaps you are mis-tracking the selected item.

 I've double checked what I thought I knew -- but as you imply, who knows
 at this point.


 You are mis-tracking the selected item, I think. The delegate method
 ‘outlineView:shouldSelectItem:’ doesn’t tell you what *is* selected, nor
 (necessarily) what *will be* selected. All it tells you is that
 NSOutlineView has some reason for asking you whether it *could be* selected.

 A better delegate method to track what’s actually selected is
 ‘outlineViewSelectionDidChange:’, and in that method you can ask the
 outline view for the selection.

 I think your ‘outlineView:isItemExpandable:’ method is also wrong. You
 should at least return YES when the item is nil.



___

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: Editing NSOutlineView Group Item

2014-11-04 Thread Luther Baker
Here is the chain of calls -- although not ostensibly helpful. I have 2
items in my outline view - if I select, edit and then try to reload the
item at index=1.


///
outlineView:isItemExpandable:
- item=selected item
- returns NO

outlineView:child:item
- item=nil, index=1
- returns the selected item

outlineView:isItemExpandable:
- item=selected item
- returns NO
///


Done ... the outlineView cellView does not update. I also tried hard-coding
outlineView:isItemExpandable: to always return YES ... but reloading the
selected item then simply ran the very first delegate method and then
stopped.


///
outlineView:isItemExpandable:
- item=selected item
- returns YES
///


Thanks,
-Luther



On Tue, Nov 4, 2014 at 7:12 AM, Luther Baker lutherba...@gmail.com wrote:

 I was hoping these changes would do it ... but unfortunately, I'm still
 getting nothing 

 You'll notice the logging below - I can confirm that the address of and
 object *selected* is the exact same address of and object I am *reloading*.
 Furthermore, the description logging from outlineViewSelectionDidChange:
 prints out the old text and the description logging from
 reloadSelectedIssue prints out the new text.

 Unfortunately, outlineView:viewForTableColumn: is never invoked.

 Thanks for the extended help Quincey,
 -Luther


 - (BOOL)outlineView:(NSOutlineView *)outlineView
 isItemExpandable:(idPVOutlineViewItem)item {
 return (item == nil);
 }

 - (void)outlineViewSelectionDidChange:(NSNotification *)notification {
 NSOutlineView *outlineView = notification.object;
 NSInteger selectedRow = outlineView.selectedRow;
 _selectedItem = [outlineView itemAtRow:selectedRow];
 NSLog(@selected item:(%@), self.selectedItem);
 }

 - (void)reloadSelectedIssue {
 NSLog(@reload selected item: %@, _selectedItem);
 [_outlineView reloadItem:_selectedItem reloadChildren:YES];
 }


 On Mon, Nov 3, 2014 at 11:55 AM, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:

 On Nov 3, 2014, at 04:12 , Luther Baker lutherba...@gmail.com wrote:


  Or perhaps you are mis-tracking the selected item.

 I've double checked what I thought I knew -- but as you imply, who knows
 at this point.


 You are mis-tracking the selected item, I think. The delegate method
 ‘outlineView:shouldSelectItem:’ doesn’t tell you what *is* selected, nor
 (necessarily) what *will be* selected. All it tells you is that
 NSOutlineView has some reason for asking you whether it *could be* selected.

 A better delegate method to track what’s actually selected is
 ‘outlineViewSelectionDidChange:’, and in that method you can ask the
 outline view for the selection.

 I think your ‘outlineView:isItemExpandable:’ method is also wrong. You
 should at least return YES when the item is nil.




___

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: Editing NSOutlineView Group Item

2014-11-04 Thread Luther Baker
I've created a project on github that essentially duplicates the problem
I'm having.

$ git clone
https://github.com/EffectiveProgramming/LBOutlineViewDemo.git

If you have time, please feel free to check it out and let me know if you
can see what I'm doing wrong.

Thanks,
-Luther


On Tue, Nov 4, 2014 at 1:21 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

   I have 2 items in my outline view - if I select, edit and then try to
 reload the item at index=1.

 Here is new information. What does “edit” mean? Are you talking about
 editing the text in the row in the outline view, or editing properties of
 the object represented by the row elsewhere in the window, which imply a
 change in its item’s appearance in the outline view?

 One thing you could try, just before you invoke ‘reloadItem:’, is to log
 the items in the view. That is, loop over the view’s row by rowIndex,
 fetching the item for each row, and logging the item pointer and
 description. (This will not log rows in collapsed parents, of course, but
 that’s part of the point.) Then check to make sure the item you’re
 selecting is in this list.

 If, for some reason, editing causes the identity of the item to change,
 then I’d expect to see failures like you’re getting.


___

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

nested split views

2014-11-03 Thread Luther Baker
One more question about split views.

My app's outer shell is a top level, 3 tiered split view with the idea that
the middle view could have ANYTHING in it. A diagram, a browser, a tree. In
fact, the middle view could contain yet another split view if I come up
with a visualization that requires that.

So that's what I did. The outer view picks the project and now I've got an
internal split view for the data representation ... and it all works save
for one problem. Autosave.

Upon app restart from Xcode, the outer split view remembers the position of
its splitters whereas the inner split view does not - it always defaults
the splitters to their original positions. The two split views use unique
Autosave and Xcode identifiers/names but most everything else about them is
identical ...

Is this an internal limitation or have other folks done this successfully
out of the box. Autosave positioning working for all nested split views.

I'm running Xcode 6.1 on 10.10.

Thanks,
-Luther
___

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: Editing NSOutlineView Group Item

2014-11-02 Thread Luther Baker
Indeed ... I was incorrectly using reloadDataForRowIndexes:columnIndexes:
... and not reloadItem:reloadChildren.

Thank you,
-Luther


On Sun, Nov 2, 2014 at 4:35 PM, Graham Cox graham@bigpond.com wrote:


 On 3 Nov 2014, at 9:18 am, Ken Thomases k...@codeweavers.com wrote:

  This is not correct.  Group items are items for which the delegate
 returns YES from -outlineView:isGroupItem:.  They can have children or not.


 Yes, my misunderstanding - I've only used group rows for section labelling
 (no children).

  All of the mentions of reloading a _row_ in the above show the
 misunderstanding.

 Yup. Though NSOutlineView subclasses NSTableView, the table view methods
 shouldn't be used for reloading where a special outline view method has
 been provided. That would be -reloadItem:reloadChildren:

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

Tracking Focus Between NSOutlineViews

2014-11-02 Thread Luther Baker
I have multiple NSOutlineView objects on the screen at one time.

As you select items in secondary outline views, the existing selections in
the other outline views stay selected, and generally turn from a selected
BLUE to an alternate selected GRAY. That is fine and expected.

Now, off to the right side of the window, I have a context DETAIL view that
displays a few editable fields - depending on the the active selection
(just like Xcode does with the contextual right hand view).

The outline view delegates fire when a selection changes ... or should
change -- but they don't say anything if you simply reselect an existing
selection (turning it from GRAY to BLUE).

Is there a best practice convention to follow the active selection so I
can update the contextual view correctly? I am using view based outline
views -- so I guess I could put mouse handlers on them - or the rows - or
the cells ... but I'd prefer to use the NSOutlineView tooling (if it
exists) to track the active selection.

Just looking for some experienced input here, a rough suggestion in the
right direction here so that I don't reinvent built in functionality. Every
Source / Outline View / Detail view app is doing it these days.

Thanks,
-Luther
___

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 Focus Between NSOutlineViews

2014-11-02 Thread Luther Baker
My current project idea is for a 3 way split view app with milestones on the 
left (in a source view), hierarchical tasks in the middle (a standard outline 
view) and a swappable details area in the right pane (this is sort of what 
omnifocus does).

You start the app and if you select a milestone I show a milestones detail 
editor view in the right details area. Also, after selecting that milestone, 
a hierarchical view of milestone tasks shows up in the middle view. Now you 
select one of the tasks the details area changes to show a task editor for that 
specific task. All good so far.

Oh, you realize you need to fix something in the milestone ... so you tap that 
same milestone again and the milestone editor shows back up on the right (and 
yes, the task is still selected in the middle, just not emphasized).

Is that behavior an anti-pattern of some sort? Is there a more intuitive way? 
Is FR a rabbit hole ... bcs naively, it certainly seems to be what I'm looking 
for.

I thought the current trend was away from modals and panes ... so I was trying 
to keep everything in one window. Are people not contextually repurposing areas 
like this? In my mind, I was thinking It's always an editor of whatever is 
currently in focus..

Would appreciate any alternatives or validation either way. Thanks as always 
for lending your skills to this discussion!

Thanks,
Luther



 On Nov 2, 2014, at 5:27 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 3 Nov 2014, at 9:50 am, Luther Baker lutherba...@gmail.com wrote:
 
 Now, off to the right side of the window, I have a context DETAIL view that
 displays a few editable fields - depending on the the active selection
 (just like Xcode does with the contextual right hand view).
 
 The outline view delegates fire when a selection changes ... or should
 change -- but they don't say anything if you simply reselect an existing
 selection (turning it from GRAY to BLUE).
 
 There is no change to the selection. What has happened is that there has been 
 a change to the view that has first responder status in the window.
 
 Is there a best practice convention to follow the active selection so I
 can update the contextual view correctly? I am using view based outline
 views -- so I guess I could put mouse handlers on them - or the rows - or
 the cells ... but I'd prefer to use the NSOutlineView tooling (if it
 exists) to track the active selection.
 
 I think this may indicate a problem with your design, if the current first 
 responder makes a difference to your detail view, you're probably Doing It 
 Wrong™. What happens when you tab into one of those detail fields? It becomes 
 first responder itself, so all of your outline views lose focus. If you were 
 tracking this FR status to update your detail view, trying to type into a 
 field would cause that field to disappear.
 
 I would just use the selection indexes of your outline view(s) to set up your 
 detail views and ignore FR state. Tracking FR state can be done but it's 
 actually not that easy, since there are no notifcations you can hook into, 
 though you can KVO observe it. This is likely deliberate to stop people 
 trying to do the sort of thing you think you want here. Your outline view 
 delegates are informed when the selection changes, that's the only 
 information you should be using to determine your detail view content.
 
 --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: Tracking Focus Between NSOutlineViews

2014-11-02 Thread Luther Baker
Good question. I struggled with that. For now, the 2 outline views give me the 
option of hierarchy should I need it ... 

Releases / milestones / iterations
Features / tasks

But to your point, browser semantics are an option if my design is going to 
confuse the user.

Is Xcode worth considering here? Tap a class file and you get details about 
that class in the right pane. Open a XIB ... Tap something in the XIB and the 
details pane changes to reflect the XIB selection, not the file anymore. Same 
goes for core data modeling while creating entities.

Does that not demonstrate a potentially fine way to build user facing software?

Thanks,
Luther


 On Nov 2, 2014, at 5:42 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 3 Nov 2014, at 9:50 am, Luther Baker lutherba...@gmail.com wrote:
 
 I have multiple NSOutlineView objects on the screen at one time.
 
 As you select items in secondary outline views, the existing selections in
 the other outline views stay selected, and generally turn from a selected
 BLUE to an alternate selected GRAY. That is fine and expected.
 
 
 Incidentally, are you sure NSBrowser wouldn't be a better fit? I'm wondering 
 how usable multiple NSOutlineViews would be.
 
 --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: Tracking Focus Between NSOutlineViews

2014-11-02 Thread Luther Baker
Again - thanks for the extended notes here. I really appreciate the extra
context I get form this group.

Thanks,
-Luther


On Sun, Nov 2, 2014 at 6:56 PM, Graham Cox graham@bigpond.com wrote:


 On 3 Nov 2014, at 11:13 am, Luther Baker lutherba...@gmail.com wrote:

  You start the app and if you select a milestone I show a milestones
 detail editor view in the right details area. Also, after selecting that
 milestone, a hierarchical view of milestone tasks shows up in the middle
 view. Now you select one of the tasks the details area changes to show a
 task editor for that specific task. All good so far.


 Why not make the milestone tasks children of a milestone item in the same
 outline view? Then you remove the ambiguity of which item is selected -
 there's only one, whether it's a milestone, a task or a subtask. The detail
 view should display whatever's appropriate to the 'level' of the item
 selected.

 Depending on the complexity of your details though, these could even be
 inline as items in the outline view itself. View-based outline view rows
 make that much easier than it used to be, and often more versatlie, since
 if the user decides to open more than one at a time, they can, and just
 edit freely.

  Is FR a rabbit hole ... bcs naively, it certainly seems to be what I'm
 looking for.

 If your detail view changes according to FR status, I think it'll become a
 rabbit hole, because of the case of neither outline view having focus. What
 does the detail view display then? Nothing? If so, tabbing into a detail
 view field will remove all of the views from the detail view, including the
 field you just tabbed into. Derp.

  I was trying to keep everything in one window. Are people not
 contextually repurposing areas like this?

 Master-detail designs are fine, in many cases. I'm not suggesting you
 don't do that, just avoid the potential ambiguity of having two master
 views.

  In my mind, I was thinking It's always an editor of whatever is
 currently in focus..

 It can't be, because parts of the editor itself will sometimes (often)
 have the focus. It should be an editor of whatever is selected. But to
 make that work you don't want the selection to be ambiguous. So extend the
 hierarchy so that milestones are containers for task groups, and releases
 are containers for milestones. Also, if you allow *multiple* selections in
 the table, consider how you'd make that work. For example, if all tasks
 share a detail interface, and you select more than one task, would it be
 useful to allow the detail editor to allow values for those several tasks
 to be edited simultaneously? All values or only some? How do you display
 values that differ among the tasks? The question can be avoided by only
 allowing one selection at a time, but this could limit the user's abilities
 in ways that cause other issues. Suppose they need to change some value of
 a whole lot of tasks to some common value - if they have to do this one
 item at a time they'll be cursing you. (n.b. bindings has solutions for
 many of these questions).

  Is Xcode worth considering here? Tap a class file and you get details
 about that class in the right pane. Open a XIB ... Tap something in the XIB
 and the details pane changes to reflect the XIB selection, not the file
 anymore. Same goes for core data modeling while creating entities.
 
  Does that not demonstrate a potentially fine way to build user facing
 software?

 The selection in Xcode's source list chooses an appropriate editor for the
 selection. One of those editors - IB - has its own outline view for its
 object hierarchy. But that second outline view is really the detail, not
 a master picker for further detail - the rest of the view shows a different
 representation of the same information, laid out spatially rather than
 hierarchically. That's why the two representations' selections stay in
 synch - they're two views of the same thing. (i.e. with IB showing you have
 master-detail+detail, not master-master-detail).

 --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: Editing NSOutlineView Group Item

2014-11-02 Thread Luther Baker
So, before we get to the 'group' question - I seem to be having some
difficulty with the item specific API. If I change the call from reloadData
to reloadItem ... and if we consider reloading the selected row ... then:

[outlineView reloadItem:selectedObject reloadChildren:YES or NO];

invokes (in order)

[outlineView:ov isItemExpandable:selectedItem]; /// return NO, bcs it
is a leaf
outlineView:ov child:1 ofItem:nil /// return selectedItem ... bcs it is
the one we are reloading
outlineView:ov isItemExpandable:selectedItem /// NO, bcs it is a leaf

done  nothing happens, no refresh

when I instead use

outlineView reloadDataForRowIndexes:columnIndexes /// it works
[outlineView reloadItem:nil] also works fine

the first one invokes

[outlineView:ov viewForTableColumn:tableColumn item:selectedItem]

straight away ... and therefore works to refresh the display -- while the
second way kicks off

[outlineView:ov numberOfChildrenOfItem:nil]

also working - proceeding through all the rows.

Seeing as this is a view based NSOutlineView ... do I need to somehow
invalidate the cell view? reloadItem starts the process but it gets cut
short somehow -- maybe by a method I don't implement and I'm not breaking
on? Other people have had a similar experience ...
http://stackoverflow.com/questions/19963031/nsoutlineview-reloaditem-has-no-effect
but I'm afraid we must be missing something.

As an aside, right now I don't have a deep enough test data set to see if I
simply need to load the parent or if I need to reload the entire table 

Thanks,
-Luther




On Sun, Nov 2, 2014 at 4:42 PM, Luther Baker lutherba...@gmail.com wrote:

 Indeed ... I was incorrectly using reloadDataForRowIndexes:columnIndexes:
 ... and not reloadItem:reloadChildren.

 Thank you,
 -Luther


 On Sun, Nov 2, 2014 at 4:35 PM, Graham Cox graham@bigpond.com wrote:


 On 3 Nov 2014, at 9:18 am, Ken Thomases k...@codeweavers.com wrote:

  This is not correct.  Group items are items for which the delegate
 returns YES from -outlineView:isGroupItem:.  They can have children or not.


 Yes, my misunderstanding - I've only used group rows for section
 labelling (no children).

  All of the mentions of reloading a _row_ in the above show the
 misunderstanding.

 Yup. Though NSOutlineView subclasses NSTableView, the table view methods
 shouldn't be used for reloading where a special outline view method has
 been provided. That would be -reloadItem:reloadChildren:

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

Editing NSOutlineView Group Item

2014-11-01 Thread Luther Baker
I've got an NSOutlineView backed by a manually mapped core data based
document model of which I can save edits to the persistence store just fine.

I have created a detail view which can update the text of the selected item
- and for the most part, telling the outline view to reload data for the
selected row is working out ... unless the row is designated as a GROUP row.

The group row just doesn't seem to respond to a reload directive ... even
if I include all the columns (of which it really has none).

How do I get an NSOutlineView row, designated as a group row, to reload
itself?

Thanks,
-Luther
___

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: NSComboBox in the tab ring

2014-10-30 Thread Luther Baker
Yep - I ended up going with a Pop Up Button for the reason's you've both
mentioned.

Thanks for replying with a bit of explanation and suggestions!
-Luther


On Wed, Oct 29, 2014 at 3:16 PM, Graham Cox graham@bigpond.com wrote:


 On 19 Oct 2014, at 3:14 pm, Luther Baker lutherba...@gmail.com wrote:

  I don't want to allow the user to type randomly into the text
  field


 It *is* a text field. Sounds like what you really want is a pop-up menu
 button.

 --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: Extended Save Dialog Crashing

2014-10-28 Thread Luther Baker
The stack trace looks like

Thread 4
Queue: quicklook.pluginload (serial)
0 __cxa_throw
19 start_wqthread
Enqueued from com.apple.root.default-overcommit-priority (Thread 12)
0 _dispatch_barrier_async_f_slow
10 thread_start

but nothing is logged to the console ... which makes me wonder. I hit
'continue' a few times and it keeps breaking and replacing my editor with
the assembly I pasted before. I notice I've got a breakpoint to catch All
Exceptions ... so I turn that off and rerun and what do you know? No
problems. In fact, I put the same breakpoint in my brand new test project
and same outcome - the dialogs are throwing an internal exception.

So I guess the exception is a part of that dialog's natural code path. I've
seen Core Data use this intentional technique in certain situations as well
so seems like nothing is wrong. I just can't leave the All Exceptions
breakpoint on when saving or opening (or I need to provide an exception in
the breakpoint).

Thanks for driving me to find this by asking for the stack and logged
error. Will note for next time before bothering the list. App is coming
along nicely thanks to you all!

-Luther


On Tue, Oct 28, 2014 at 1:29 AM, Kyle Sluder k...@ksluder.com wrote:



 Sent from my iPad

  On Oct 27, 2014, at 8:33 PM, Luther Baker lutherba...@gmail.com wrote:
 
  I'm writing my first Document based app for OSX and have reached a spot
  where I'd like to actually save and open a file. It is a Core Data backed
  Document within which I create some arbitrary data and display it via two
  NSOutlineViews. I also have the ability to edit the data inline and save
 it
  back to the screen ... so I thought I'd actually try saving and opening
  from disk.
 
  Unfortunately, on my first attempt to save, I clicked the little triangle
  to open the EXTENDED save dialog and almost immediately, the app crashed.
  Subsequent attempts to formally save automatically open the EXTENDED save
  dialog and immediately crash. Attempts to OPEN a file also open an
 EXTENDED
  version of the Open dialog and crash.
 
  (stack trace below ...)

 You didn’t provide a stack trace; you pasted the disassembly for the C++
 throw statement.

 Can you please log the actual stack trace along with the exception that is
 logged to the console?

 --Kyle Sluder

___

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

Editing an NSOutlineView item

2014-10-27 Thread Luther Baker
I've successfully built an NSOutlineView and configured the items for
editing. Got that working.

Now, in my delegate/datasource, I am implementing

- (BOOL)outlineView:(NSOutlineView *)outlineView
shouldEditTableColumn:(NSTableColumn *)tableColumn
   item:(id)item {
NSLog(@hi);
}

but when I tap on a field a 2nd time to edit it - this never gets invoked.
I am also implementing

- (void)outlineView:(NSOutlineView *)outlineView
 setObjectValue:(id)object
 forTableColumn:(NSTableColumn *)tableColumn
 byItem:(id)item {
NSLog(@hi);
}

but once I replace the text of the field and hit enter, this is not called
either. Is there something else I must to do get complete editing
capability?

Also, 1 final trivial question ... let's say I want to allow editing ONLY
after right clicking and picking a context menu item. Assuming I can get
the row and column from the event, how do I programmatically turn the
editor on for a specific field?

Thanks,
-Luther
___

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: Editing an NSOutlineView item

2014-10-27 Thread Luther Baker
Thanks Ken. Just what I needed.

-Luther



On Mon, Oct 27, 2014 at 7:47 PM, Ken Thomases k...@codeweavers.com wrote:

 On Oct 27, 2014, at 7:02 PM, Luther Baker lutherba...@gmail.com wrote:

  I've successfully built an NSOutlineView and configured the items for
  editing. Got that working.
 
  Now, in my delegate/datasource, I am implementing
 
  - (BOOL)outlineView:(NSOutlineView *)outlineView
  shouldEditTableColumn:(NSTableColumn *)tableColumn
item:(id)item {
 NSLog(@hi);
  }
 
  but when I tap on a field a 2nd time to edit it - this never gets
 invoked.

 I'm guessing that you're using a view-based outline view (as you should,
 since it's the modern way).  The above method is only used for NSCell-based
 outline views.  This is not as clearly documented as it should be.  The
 corresponding method for NSTableView is clearly documented as only valid
 for NSCell-based table views.

 In a view-based outline view, the individual views within the cells of the
 outline view act (almost) just like views elsewhere.  An NSTextField
 controls its own editability.  You can use bindings to control the text
 field's editability or you can set its editable property as conditions
 warrant.

 The outline view is involved in a less direct manner.  Its implementation
 of -validateProposedFirstResponder:forEvent: is called and can control
 whether the text field can become first responder, a.k.a. begin editing.


  I am also implementing
 
  - (void)outlineView:(NSOutlineView *)outlineView
  setObjectValue:(id)object
  forTableColumn:(NSTableColumn *)tableColumn
  byItem:(id)item {
 NSLog(@hi);
  }
 
  but once I replace the text of the field and hit enter, this is not
 called
  either. Is there something else I must to do get complete editing
  capability?

 Again, this is not used for view-based outline views and this is most
 clearly documented for the corresponding table view method.  You can use
 bindings to tie the text field's value to a key path of the object
 associated with the cell or you can use target-action to trigger a method
 when the text field's value has changed.


  Also, 1 final trivial question ... let's say I want to allow editing ONLY
  after right clicking and picking a context menu item. Assuming I can get
  the row and column from the event, how do I programmatically turn the
  editor on for a specific field?

 The traditional way is to use -editColumn:row:withEvent:select:, but it's
 more complicated with view-based outline views.  That method will attempt
 to make the cell view the first responder.  Not all views accept first
 responder and support a notion of editing when they are first responder.
 For example, NSTableCellView does not, and that's commonly used as the cell
 view.

 If you use a bare NSTextField as the cell view, then the above method will
 work directly because the text field will accept first responder and begin
 editing (assuming it's editable).

 If you're using a compound cell view and you want to initiate editing on a
 particular text field within it, you should make it first responder
 directly:

 NSTableCellView* tableCellView = [outlineView viewAtColumn:column
 row:row makeIfNecessary:NO];
 NSTextField* textField = tableCellView.textField;
 if ([textField acceptsFirstResponder])
 [textField.window makeFirstResponder:textField];

 You may also want to select the row and scroll it into view.

 Regards,
 Ken


___

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

Extended Save Dialog Crashing

2014-10-27 Thread Luther Baker
I'm writing my first Document based app for OSX and have reached a spot
where I'd like to actually save and open a file. It is a Core Data backed
Document within which I create some arbitrary data and display it via two
NSOutlineViews. I also have the ability to edit the data inline and save it
back to the screen ... so I thought I'd actually try saving and opening
from disk.

Unfortunately, on my first attempt to save, I clicked the little triangle
to open the EXTENDED save dialog and almost immediately, the app crashed.
Subsequent attempts to formally save automatically open the EXTENDED save
dialog and immediately crash. Attempts to OPEN a file also open an EXTENDED
version of the Open dialog and crash.

(stack trace below ...)

 but, if I click in the upper part of the toolbar and give the
window/document a name, it actually saves (albeit as a *.binary file).
Also, if I try to EXIT from the program, I am prompted to save at which
time the mini save dialog shows up and I can save as binary, sqlite or xml.
When I restart the app, I can successfully open the files I've saved via
File / Recents menu and see the changes I made via my editing. I just can't
open the EXTENDED save and EXTENDED open dialogs. If I create a new project
from scratch, the extended dialogs work just fine ... but clearly, they
don't have all the work I've done to create the views and Core Data model.

Does this problem this ring a bell with anyone? Since I can save and open
files I would think that the Extended dialogs don't like something about my
project --- but I'm not sure what that could actually be nor how to track
it down. The stack below is just most assembler into the core os.

At a minimum, is there anything I can do to actually reset the app back so
that it does not use the EXTENDED dialogs? With iOS, I would just reset the
simulator ... but I'm not sure on the desktop. Is there a plist directory
somewhere I can clean out that effectually does the same thing?

Thanks much,
-Luther




libc++abi.dylib`__cxa_throw:
0x7fff8d64abdf:  pushq  %rbp
0x7fff8d64abe0:  movq   %rsp, %rbp
0x7fff8d64abe3:  pushq  %r15
0x7fff8d64abe5:  pushq  %r14
0x7fff8d64abe7:  pushq  %r13
0x7fff8d64abe9:  pushq  %r12
0x7fff8d64abeb:  pushq  %rbx
0x7fff8d64abec:  pushq  %rax
0x7fff8d64abed:  movq   %rdx, %r14
0x7fff8d64abf0:  movq   %rsi, %r15
0x7fff8d64abf3:  movq   %rdi, %rbx
0x7fff8d64abf6:  callq  0x7fff8d64a7f4; __cxa_get_globals
0x7fff8d64abfb:  movq   %rax, %r12
0x7fff8d64abfe:  callq  0x7fff8d64b180; std::get_unexpected()
0x7fff8d64ac03:  movq   %rax, -0x60(%rbx)
0x7fff8d64ac07:  callq  0x7fff8d64b1ba; std::get_terminate()
0x7fff8d64ac0c:  leaq   -0x20(%rbx), %r13
0x7fff8d64ac10:  leaq   0x44(%rip), %rcx  ;
__cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
0x7fff8d64ac17:  movabsq $0x434c4e47432b2b00, %rdx
0x7fff8d64ac21:  movq   %rax, -0x58(%rbx)
0x7fff8d64ac25:  movq   %r15, -0x70(%rbx)
0x7fff8d64ac29:  movq   %r14, -0x68(%rbx)
0x7fff8d64ac2d:  movq   %rdx, -0x20(%rbx)
0x7fff8d64ac31:  movq   $0x1, -0x78(%rbx)
0x7fff8d64ac39:  incl   0x8(%r12)
0x7fff8d64ac3e:  movq   %rcx, -0x18(%rbx)
0x7fff8d64ac42:  movq   %r13, %rdi
0x7fff8d64ac45:  callq  0x7fff8d64d9cc; symbol stub for:
_Unwind_RaiseException
0x7fff8d64ac4a:  movq   %r13, %rdi
0x7fff8d64ac4d:  callq  0x7fff8d64ac7f; __cxa_begin_catch
0x7fff8d64ac52:  movq   -0x58(%rbx), %rdi
0x7fff8d64ac56:  callq  0x7fff8d64b1c9; std::__terminate(void
(*)())
___

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

Custom NSTableRowView Question

2014-10-20 Thread Luther Baker
I've created and I'm displaying a custom NSTableRowView but I'm having
trouble settings its background color.

I tried setting it in the init'r but it is getting overwritten. I can
intercept the calls to [NSTableRowView setBackgroundColor:] and override
the color but before doing that, I'd like to better understand why the
color is being set by something else ... and then maybe work within that
architecture.

With a breakpoint in [NSTableRowView setBackgroundColor:], the stack trace
shows me that if I programmatically invoke: [NSTableView setRowSizeStyle:],
then [NSTableRowData _setBackgroundColorForRowView:] fires on my custom row
view with a color I didn't control.

Additonally, when I programmatically invoke [NSOutlineView expandItem:],
then [NSTableRowData _setBackgroundColorForRowView:] again fires with a
color I didn't set.

The background color doesn't get set when I manually expand rows.

I'm not sure what other methods secretly reset this background color -- but
is there an appropriate way to have the private NSTableRowData
invocations set the correct colors?

As I mentioned, I can obviously implement setBackgroundColor on the custom
table row - but I'm not sure I understand all the possible states I should
account for. expanding? selected? etc ... it feels a little heavy handed.

For what its worth, setting the color as part of the NSOutlineView
delegate's didAddRowView: seems to stick - but since this is a custom row,
I prefer to encapsulate the color management in the custom NSTableRowView
class itself. Maybe I'm thinking wrong ...

Is there an established convention around this?
-Luther
___

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

Wiring up MainMenu.xib

2014-10-19 Thread Luther Baker
I created a Document based app and Xcode created two XIB - MainMenu.xib and
Document.xib. Per the online docs for subclassing NSWindowController, I
created my own NSWindowController subclass and set that as the File's
Owner for the Document.xib and so far, everything has worked fine.

Now, I added two menu items to MainMenu.xib and I'd like to wire them up to
corresponding actions in my custom NSWindowController subclass, the File's
Owner in Document.xib.

In MainMenu.xib, I could drag an Object into MainMenu.xib and set it to
be the custom NSWindowController and then drag the menu items to the
corresponding IBActions and when the app starts those methods do indeed get
called but understandably, they get invoked on a different instance of
NSWindowController ... which doesn't have any of my other properties set.

What is the correct way to have menu items in MainMenu.xib invoke actions
in classes defined elsewhere? Specifically, the app's main
NSWindowController subclass which I generally wire up in the Document.xib
file?

Thanks,
-Luther

Reasons To ... How to Subclass NSWindowController ...
https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/KeyObjects/KeyObjects.html
___

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: Wiring up MainMenu.xib

2014-10-19 Thread Luther Baker
I see ... the old First Responder Proxy trick :-)

Thanks Scott,
-Luther


On Sun, Oct 19, 2014 at 9:50 AM, Scott Ribe scott_r...@elevated-dev.com
wrote:

 Sorry, duh, you wire it up to First Responder.

 On Oct 19, 2014, at 8:47 AM, Scott Ribe scott_r...@elevated-dev.com
 wrote:

  You don't need to wire that up in IB. You just need to implement the
 action in your window controller.
 
  On Oct 19, 2014, at 8:36 AM, Luther Baker lutherba...@gmail.com wrote:
 
  I created a Document based app and Xcode created two XIB - MainMenu.xib
 and
  Document.xib. Per the online docs for subclassing NSWindowController, I
  created my own NSWindowController subclass and set that as the File's
  Owner for the Document.xib and so far, everything has worked fine.
 
  Now, I added two menu items to MainMenu.xib and I'd like to wire them
 up to
  corresponding actions in my custom NSWindowController subclass, the
 File's
  Owner in Document.xib.
 
  In MainMenu.xib, I could drag an Object into MainMenu.xib and set it
 to
  be the custom NSWindowController and then drag the menu items to the
  corresponding IBActions and when the app starts those methods do indeed
 get
  called but understandably, they get invoked on a different instance of
  NSWindowController ... which doesn't have any of my other properties
 set.
 
  What is the correct way to have menu items in MainMenu.xib invoke
 actions
  in classes defined elsewhere? Specifically, the app's main
  NSWindowController subclass which I generally wire up in the
 Document.xib
  file?
 
  Thanks,
  -Luther
 
  Reasons To ... How to Subclass NSWindowController ...
 
 https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/KeyObjects/KeyObjects.html
  ___
 
  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/scott_ribe%40elevated-dev.com
 
  This email sent to scott_r...@elevated-dev.com
 
 
  --
  Scott Ribe
  scott_r...@elevated-dev.com
  http://www.elevated-dev.com/
  (303) 722-0567 voice
 
 
 
 


 --
 Scott Ribe
 scott_r...@elevated-dev.com
 http://www.elevated-dev.com/
 (303) 722-0567 voice





___

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: Wiring up MainMenu.xib

2014-10-19 Thread Luther Baker


 On Oct 19, 2014, at 7:20 PM, Graham Cox graham@bigpond.com wrote:
...
 Maybe you're joking, but, well, that's not a trick. It's a key part of 
 Cocoa design.

Good catch. I called it a trick as it surprised me that it worked as such. 
Indeed, I did not really understand why it worked nor how my IBActions were 
showing up as actions on the first responder. What you're saying makes great 
sense and motivates the rationale nicely. 

Coming from iOS I've not had great occasion to pay much, if any, to first 
responders in Xibs. Thanks very much for following up and expanding on the 
concept in layman's terms - even after the original question was answered.

-Luther 



 If you have an app where the responder changes dynamically - which is usually 
 the case - wiring a menu action to First Responder means that the menu is 
 only available when the object that can respond to it is actually First 
 Responder, or part of the responder chain behind it. Any other time, it's 
 greyed out for you. This is simple and elegant and actually about the only 
 really practical way to do things - consider how you could wire a menu action 
 that applied to a particular kind of view in a multi-document interface where 
 there could be any number of such views but only one active at a time. It 
 quickly becomes a horrible nightmare if there would have to be a single, 
 definite object to which all actions are sent (e.g. app delegate). You'd end 
 up solving that problem by implementing a responder chain maintained by the 
 app and directing actions up through that chain. Luckily, that's exactly how 
 it works already.
 
 Note that all app frameworks since MacApp 1.0 (TCL, Powerplant as well) have 
 all worked in the same way, so it's obviously a good pattern for this problem.
 
 --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

Document style programming

2014-10-18 Thread Luther Baker
Hi,

I am creating a Desktop issue tracking app using core data and the
NSDocument framework - so yes, the Xcode wizard extended
NSPersistentDocument which provides me with an NSManagedObjectContext.

My question is - if I start working in the app, creating issues for
instance ... when I go to actually persist the context I get an error This
NSPersistentStoreCoordinator has no persistent stores.  It cannot perform a
save operation.

So, does this imply that for NSDocument style programming, most folks
aren't 'saving' their context right away? Do we wait for the user to
actually save the document the first time? IE: there is not in memory store
that the Document manages until the user formally saves to the file system?

And does it follow then that on subsequent changes, we formally persist the
context only when the user actually 'Saves'?

Does anyone force the user to 'find' a file location right away, upon
opening a new document, and then persist everything happily in the
background?

I tend to this this is really just a Desktop paradigm question more than
anything else.

Thanks,
-Luther
___

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

Saving a Document style app

2014-10-18 Thread Luther Baker
I'd like to save my Document based app in the bundle style format. IE: I'd
like to save things in a directory - like apps like OmniOutliner do.

Out of the box, I get the option to save as sqlite, binary or XML. What I'd
like is to save a 'bundle' with my own extension and nest things like the
the sqlite database inside of it.

Is this type of functionality provided for me by another Cocoa framework or
is this a strictly manual process that has been passed down as convention
from dev to dev?

Is anyone aware of an Apple example app that would demonstrate this? Or any
suggestions regarding an Open Source Cocoa App by anyone here that would be
worth browsing through for this type of stuff?

Thanks,
-Luther
___

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: Document style programming

2014-10-18 Thread Luther Baker
Thanks Mike.

Let me ask another question ... what if I need to create a temporary,
thread specific NSManagedObjectContext? Let's say I'm interacting with a
RESTful API ala AFNetworking and I need to parse and save data on a
background response thread.

How do I tie my thread specific context into the Document's datastore?

Thanks,
-Luther


On Sat, Oct 18, 2014 at 11:03 AM, Mike Abdullah mabdul...@karelia.com
wrote:

 When using NSPersistentDocument it takes over responsibility for saving
 the context. You should not save the context yourself.

  On 18 Oct 2014, at 17:00, Luther Baker lutherba...@gmail.com wrote:
 
  Hi,
 
  I am creating a Desktop issue tracking app using core data and the
  NSDocument framework - so yes, the Xcode wizard extended
  NSPersistentDocument which provides me with an NSManagedObjectContext.
 
  My question is - if I start working in the app, creating issues for
  instance ... when I go to actually persist the context I get an error
 This
  NSPersistentStoreCoordinator has no persistent stores.  It cannot
 perform a
  save operation.
 
  So, does this imply that for NSDocument style programming, most folks
  aren't 'saving' their context right away? Do we wait for the user to
  actually save the document the first time? IE: there is not in memory
 store
  that the Document manages until the user formally saves to the file
 system?
 
  And does it follow then that on subsequent changes, we formally persist
 the
  context only when the user actually 'Saves'?
 
  Does anyone force the user to 'find' a file location right away, upon
  opening a new document, and then persist everything happily in the
  background?
 
  I tend to this this is really just a Desktop paradigm question more than
  anything else.

___

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

One more Document app style question

2014-10-18 Thread Luther Baker
Coming from an iOS background, I'm used to seeing (and encapsulating) the
creation of key Core Data components (persistent store, location,
contexts). Everything is pretty explicit and consequently easy to follow.

When I use Xcode to generate a desktop Document based app for me, that
functionality is hidden from me. No problem ... but, I don't like the class
name Document - I'd like to change it so something specific ...
MyAppDocument. Maybe that is easy enough ... but then there's the
Document.xib file ... and Document.xcdatamodel.

So, how does the app specific Document class know which datamodel to
instantiate? Is the rule simply that the name of the NSDocument's subclass
must match the name of the datamodel file (similar to the default behavior
for xib matching)? -- or is there something I need to update in the plist
file as well?

Thanks,
-Luther
___

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: Saving a Document style app

2014-10-18 Thread Luther Baker
Awesome! Thanks Mike.

By the way, I'm a happy Hit List user!

-Luther


On Sat, Oct 18, 2014 at 11:10 AM, Mike Abdullah mabdul...@karelia.com
wrote:


  On 18 Oct 2014, at 17:06, Luther Baker lutherba...@gmail.com wrote:
 
  I'd like to save my Document based app in the bundle style format. IE:
 I'd
  like to save things in a directory - like apps like OmniOutliner do.
 
  Out of the box, I get the option to save as sqlite, binary or XML. What
 I'd
  like is to save a 'bundle' with my own extension and nest things like the
  the sqlite database inside of it.
 
  Is this type of functionality provided for me by another Cocoa framework
 or
  is this a strictly manual process that has been passed down as convention
  from dev to dev?
 
  Is anyone aware of an Apple example app that would demonstrate this? Or
 any
  suggestions regarding an Open Source Cocoa App by anyone here that would
 be
  worth browsing through for this type of stuff?

 https://github.com/karelia/BSManagedDocument


___

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: Document style programming

2014-10-18 Thread Luther Baker
As an aside, I'm sure it is well-known, there is some funny caching going
on.

If I open the app the first time (and pre-populate the context with data) -
I cannot actually SAVE.

If I formally shut the app down by quitting the app and choosing Don't
Save, then subsequent restarts exhibit the same behavior.

BUT, if I simply rerun the app from Xcode (with the app still running) --
then subsequent SAVES on the context actually work --- or at least they
don't complain about not having an attached datastore.

In fact, the block of code that creates the temp data is based on the
existence of data in the database and it doesn't run on subsequent Xcode
restarts ... which implies that when restarting the app from Xcode, the
environment tries to remember data I've created (and not yet saved).
Something was cached in the restart and now there is a persistent store of
some sort, albeit still nothing that I explicitly saved anywhere. Sort of
trippy unless you expect or understand why.

At any rate, thanks for the clarifications!

-Luther


On Sat, Oct 18, 2014 at 11:11 AM, Mike Abdullah mabdul...@karelia.com
wrote:


  On 18 Oct 2014, at 17:09, Luther Baker lutherba...@gmail.com wrote:
 
  Thanks Mike.
 
  Let me ask another question ... what if I need to create a temporary,
 thread specific NSManagedObjectContext? Let's say I'm interacting with a
 RESTful API ala AFNetworking and I need to parse and save data on a
 background response thread.
 
  How do I tie my thread specific context into the Document's datastore?

 These days, I daresay Apple would like you to split off a temporary child
 context that saves directly into its parent context (rather than the old
 way of two contexts sharing a persistent store coordinator).


___

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

NSComboBox in the tab ring

2014-10-18 Thread Luther Baker
Is it possible to keep an NSComboBox in the tabbing ring if I set its
Behavior to Selectable. Tabbing reaches the control if the textfield is
editable but I don't want to allow the user to type randomly into the text
field ... but unfortunately, once I remove its editability, the tabbing
cycle skips the control.

I'm just doing this in Xcode's IB but programmatically, I think it invokes
something like [NSCell setEditable:NO] and [NSCell setSelectable:YES].

Thanks,
-Luther
___

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

Bottom - Source/Accessory ToolBar question

2014-10-13 Thread Luther Baker
A few years back, many Mac apps had a similar looking bottom bar on the
left hand side of the app. Specifically, apps that had a Source style
outline view on the left hand side had this silverish gradient styled
bottom bar that often consisted of plus and minus buttons on the left
and a gripper control on the right.

Stunt Software's On the Job has this http://stuntsoftware.com/onthejob/
... Omni's OmniFocus had this -
http://www.macworld.com/article/1132832/omnifocus1.html ... as does The Hit
List - http://www.karelia.com/products/the-hit-list/mac.html ...

Is there a simple way to create this? It looks like a simple view with a
simple gradient --- but it does have gripper functionality. I just want to
make sure I'm not missing something that every other desktop developer
knows about. I think it is an older technique and might not be encouraged
much by the HIG anymore (Omni has moved away from that style -
http://www.omnigroup.com/omnifocus )  I almost want to know how, just
for posterity as much as anything else.

Thanks,
-Luther
___

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: Bottom - Source/Accessory ToolBar question

2014-10-13 Thread Luther Baker
Thanks both of you!

-Luther


On Mon, Oct 13, 2014 at 7:21 PM, Ken Thomases k...@codeweavers.com wrote:

 On Oct 13, 2014, at 6:54 PM, Luther Baker lutherba...@gmail.com wrote:

  A few years back, many Mac apps had a similar looking bottom bar on the
  left hand side of the app. Specifically, apps that had a Source style
  outline view on the left hand side had this silverish gradient styled
  bottom bar that often consisted of plus and minus buttons on the left
  and a gripper control on the right.

  Is there a simple way to create this? It looks like a simple view with a
  simple gradient --- but it does have gripper functionality.

 Since the buttons that go in such a button bar are usually gradient
 buttons, I have used an NSButtonCell configured as a gradient button to do
 the drawing of the background.  That way it will definitely match the style
 of the buttons.

 Apple is deprecating the use of NSCell and its subclasses.  You could use
 an actual NSButton (or make your view class a subclass of NSButton) and
 make it non-interactive.

 Drawing the actual grip lines is done manually or with an image.  As
 Graham noted, the grip functionality is a built-in feature of NSSplitView,
 provided you implement the relevant delegate method.

 Regards,
 Ken


___

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

Displaying Sheets

2014-10-07 Thread Luther Baker
I'd like to display a sheet but when I do, it isn't sliding down from the
top of my window. It is just showing up.

I am building a default Document based application and assigning the
Document.xib window to an IBOutlet I've created - invoking beginSheet on
that mainWindow with another temporary window object I've created from yet
another XIB file.

Thoughts?
-Luther
___

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: Displaying Sheets

2014-10-07 Thread Luther Baker
That was it!

Thanks,
-Luther


On Tue, Oct 7, 2014 at 7:32 AM, Mike Abdullah mabdul...@karelia.com wrote:


  On 7 Oct 2014, at 13:29, Luther Baker lutherba...@gmail.com wrote:
 
  I'd like to display a sheet but when I do, it isn't sliding down from the
  top of my window. It is just showing up.
 
  I am building a default Document based application and assigning the
  Document.xib window to an IBOutlet I've created - invoking beginSheet
 on
  that mainWindow with another temporary window object I've created from
 yet
  another XIB file.
 
  Thoughts?

 This is an old classic. Turn off “Visible at launch” in Interface Builder.


___

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

Document Based app with SQLite backing store

2014-10-05 Thread Luther Baker
Hi,

I'm learning a bit about Cocoa Desktop development and I'd like to create a
Document based app with a SQLite backing store.

First of all, the wizard/template does this just fine for me --- but the
resulting class, XIB and sqlite store are all called Document.

I'd like to change that name ... but when I try renaming things, the app
eventually stops coming up.

Does anyone know how the datastore is tied to the document so that
self.managedObjectContext works? In Xcode 6, the template doesn't even
create an App Delegate - so I can't see how the data model is tied to the
provided context in Document.

Thanks,
-Luther
___

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

kanban board, story map

2014-10-04 Thread Luther Baker
Hi,

I'm an iOS developer exploring/fairly new to desktop development - and I'd
like to implement something like a kanban board as a desktop application.

A kanban board is essentially a set of columns and swimlanes - and at a
minimum, requires the ability to add cards to columns as well as the
ability to drag cards across columns.

For greenfield, exploratory development of this, would you:

1) build a custom component to act like a kanban board
2) focus on trying to use an NSTableView
3) consider an NSCollectionView
4) other?

Another part of this app should facilitate story maps (
http://www.agilebuddha.com/agile/story-mapping-andvs-process-maps/ ) .
These are mechanisms where by features are associated with stories which
are associated with tasks. Tasks hang off of stories which hang off of
features.

I feel like both of these could be represented by a collection view ...
with holes in it. I'm just wondering if there'd be enough flexibility to
move things around per the special rules inherent in both these UI
structures.

Thanks,
-Luther
___

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

Nested NSSplitViews and AutoLayout

2014-09-27 Thread Luther Baker
I'm an iOS developer dabbling in some desktop development ...

I'm creating a simple hierarchical notebook that essentially consists of 4
columns: an outline view, a table view, a table view and then a simple text
view (the widths of each should be adjustable). To make this happen, I
thought I'd use nested vertical split views.

I dropped a root level splitView onto the XIB, pinned it to the window's
corners using autolayout and all is well. I added an outline view to the
left content view of splitView1 and pinned it to the edges via autolayout
and all is well. But now, when I try to add a second splitview to the right
hand content view of splitView1, I get a bunch of warnings in IB as soon as
I pin it to the edges of splitView1s right content view.

Has anyone else experienced this?I know that using autolayout in an iOS
UIScrollView can be tricky - and I'm wondering if this is a similar case?

Thanks,
-Luther
___

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: Nested NSSplitViews and AutoLayout

2014-09-27 Thread Luther Baker
No! I did not know that.

That is working much better for me. Thank you.

-Luther


On Sat, Sep 27, 2014 at 3:06 AM, Ken Thomases k...@codeweavers.com wrote:

 On Sep 27, 2014, at 2:46 AM, Luther Baker lutherba...@gmail.com wrote:

  I'm creating a simple hierarchical notebook that essentially consists of
 4
  columns: an outline view, a table view, a table view and then a simple
 text
  view (the widths of each should be adjustable). To make this happen, I
  thought I'd use nested vertical split views.

 Why nested split views?  Perhaps you're not aware that a split view can
 have an arbitrary number of splits.  Just drag additional views into the
 split view as immediate subviews.  Basically, a split view arranges all of
 its immediate subviews.

 Regards,
 Ken


___

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 database within sandbox

2014-08-22 Thread Luther Baker
I'm not sure how helpful this is but rechnically, Core Data is an ORM - an 
object to relational mapping framework. Also realize that Core Data is most 
often configured to use SQLite as its backing store. In addition the, Xcode 
ships with a nice CoreData/ORM editor which often makes Core Data easier and 
faster to use for the average case.

But, if you have sufficient reason, you are more than welcome to use SQLite 
directly ...  Additionally then, you may also want to consider FMDB, Gus 
Mueller's thin wrapper around SQLite that makes it much easier to work with in 
the context of an iOS app.

Finally then, the database need not necessarily reside in the Documents' 
directory ... save for the fact that different directories are cleared out 
differently based on a few rules inherent to the platform. So in a sense, yes, 
you are probably safest dropping the SQLite file there - but it isn't 
necessarily a requirement.

Hth,
-Luther


 On 23-Aug-2014, at 10:24, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
 
 I’m writing a Cocoa-based iOS 8 app that needs to store and manage data 
 locally on the device. Is there a relational database available for general 
 purpose use in iOS 8? Is there a limitation to how much space an app can use 
 in its sandbox? I presume a database would necessarily need to reside in 
 Application_Home/Documents/...
 
 -Carl
 
 
 ___
 
 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/mhoward%40mahoward.com
 
 This email sent to mhow...@mahoward.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/lutherbaker%40gmail.com
 
 This email sent to lutherba...@gmail.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

AutoLayout textfield against accessory view

2014-08-19 Thread Luther Baker
I'd like to place a UITextField in the center of a UITableViewCell such
that initially, the textfield extends to all four sides.

But ... I'd also like to make it AccessoryView friendly. Namely, when the
accessory appears (or is always appearing) I want the aforementioned
textField to shrink and not overlap the accessory. I want my textField's
TRAILING attached to the accessoryView's LEADING.

Thoughts? My initial pass complains about objects in different hierarchies.

Thanks,
-Luther
___

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: UIScrollView question

2014-07-27 Thread Luther Baker
Thanks Quincey,

First of all, you've got a good idea of what I'm trying to do - so for my
first question about how to make the text view fill the remaining space, I
think you're of the mindset that I'll need to manually calculate that
distance and set an internal height constraint on the text view.

That answer then drives the answer to the second question about what to do
when the keyboard comes up. In my case, I want to *both* scroll the view up
*AND* shrink the text view's height (since the previously mentioned
remaining space in the view is most likely not going to equal the area left
above the keyboard). It sounds like you're leaning toward adjusting the
internal height constraint on the text view.

Now, I consider those manual calculations very similar to what I'd have to
do were I laying the scroll view out via frames --- (overriding
layoutSubviews, etc). And in that regard, I think that in this scenario,
using frames would be slightly more literal for roughly the same amount of
work for roughly the same calculations. ie: frames might be more readable
and quickly grokkable later on.

This technical note
https://developer.apple.com/library/ios/technotes/tn2154/_index.html
seems to imply that either approach is fine. My brief exploration here was
to make sure there wasn't some OTHER way to setup AutoLayout for this
scenario --- the scroll view is the wrench in this equation since it auto
sizes its content view and consequently, cannot tell the text view how
large to be. In this case, I really don't want the scroll view auto sizing
its content view  but I do want the scrolling animation and dismissal
behavior.

Seems like I'll need to create something manually then. Maybe a non scroll
view parent, an affine transform and a pan gesture recognizer would
simplify the layout sizing logic and get me closer to the behavior I want.
In the end, I'm just looking for the simplest way to implement the
resulting effect.

Many thank!



On Sun, Jul 27, 2014 at 1:12 AM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On Jul 26, 2014, at 22:19 , Luther Baker lutherba...@gmail.com wrote:

 Are you hoping that when the keyboard comes up -- it shortens the parent
 view you are referring to?


 No, it’s more complicated than that, but I think it’s the *question*
 that’s complicated, more than the answer.

 First you have to decide what you actually want to happen when the
 keyboard is up. You have 4 views, you said, 3 of which I assume are short
 (maybe about 1 line high each), and the last of which takes up the rest of
 the screen normally.

 So, when the text view becomes first responder and brings up the keyboard,
 do you want all of them to keep their original sizes, but just scroll what
 doesn’t fit off the top of the screen? Or do you want to have the top 3
 views to keep their original sizes, and the text view to get smaller
 according to how much space is left by the keyboard? Or something else?

 If you don’t need to change the scroll view’s size (if “yes” to the first
 question — which I think is what you originally described as the goal),
 then setting the content and scroll indicator insets (along with scrolling
 the current insertion point onto the screen) ought to be all you need. You
 don’t actually need to resize anything.

 If you need to change the scroll view’s size, then any auto layout
 constraints *inside* the scroll view should keep your text view at a
 suitable size, and you shouldn’t need to muck about with the layout inside
 the scroll view manually. The problem then becomes one of getting the
 scroll view itself sized correctly.

 If the scroll view itself is subject to auto layout constraints relative
 to its own ancestors and siblings, I guess you’ll have to update its
 height-controlling constraint, *or* override its superview’s
 ‘layoutSubviews’ to set its frame directly after auto layout has had at it.

 If the scroll view is not subject to auto layout constraints, then you can
 just resize it directly.

 That’s a lot of if’s…


___

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

Retina and VFL vs Programmatic Layout

2014-07-26 Thread Luther Baker
In the following example, I'm displaying a child view in a container view
attached to a view controller's view property ... on a Retina iPhone
simulator.

EXPECTED: The VFL constraints cause the child to fill the screen whereas

UNEXPECTED: the programmatic constraints cause the child to fill exactly
1/4 of the screen (1/2 width, 1/2 height). The programmatic constraints
work if I set the multiplier=2.0 on each of those constraints.

I normally don't use width / height constraints this way but I'm surprised
by the outcome. Is this a Retina pixels/points thing or am I doing
something wrong?

Thanks,
-Luther


//
// 1. Fill the parent view with a simple, yellow container
//
_containerView = [[UIView alloc] init];
_containerView.backgroundColor = [UIColor yellowColor];
_containerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_containerView];

NSArray *cc = [NSLayoutConstraint constraintsWithVisualFormat:@
V:|[container]|

options:NSLayoutFormatAlignAllCenterX
  metrics:nil
views:@{
@container : _containerView }];
[self.view addConstraints:cc];
cc = [NSLayoutConstraint constraintsWithVisualFormat:@H:|[container]|

options:NSLayoutFormatAlignAllCenterY
 metrics:nil
   views:@{ @container :
_containerView }];
[self.view addConstraints:cc];

//
// 2. Add a red child to the aforementioned container view
//

UIView *childView = [[UIView alloc] init];
childView.backgroundColor = [UIColor redColor];
childView.translatesAutoresizingMaskIntoConstraints = NO;
[_containerView addSubview:childView];

// WORKS AS EXPECTED

cc = [NSLayoutConstraint constraintsWithVisualFormat:@V:|[child]|

options:NSLayoutFormatAlignAllCenterX
  metrics:nil
views:@{
@child : childView }];
[_containerView addConstraints:cc];
cc = [NSLayoutConstraint constraintsWithVisualFormat:@H:|[child]|

options:NSLayoutFormatAlignAllCenterY
 metrics:nil
   views:@{ @child :
childView }];
[_containerView addConstraints:cc];

//
// now, replace the VFL from above with this and the child view only fills
1/4 of the screen
//

NSLayoutConstraint *c = [NSLayoutConstraint constraintWithItem:childView

attribute:NSLayoutAttributeWidth

relatedBy:NSLayoutRelationEqual

toItem:_containerView

attribute:NSLayoutAttributeWidth
multiplier:1.0
  constant:0.0];
[_containerView addConstraint:c];

c = [NSLayoutConstraint constraintWithItem:childView
 attribute:NSLayoutAttributeHeight
 relatedBy:NSLayoutRelationEqual
toItem:_containerView
 attribute:NSLayoutAttributeHeight
multiplier:1.0
  constant:0.0];
[_containerView addConstraint:c];
___

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: Retina and VFL vs Programmatic Layout

2014-07-26 Thread Luther Baker
Ah, I forgot to add constraints to establish the origin.

Got it. Thanks,
-Luther



On Sat, Jul 26, 2014 at 10:44 AM, Luther Baker lutherba...@gmail.com
wrote:

 In the following example, I'm displaying a child view in a container view
 attached to a view controller's view property ... on a Retina iPhone
 simulator.

 EXPECTED: The VFL constraints cause the child to fill the screen whereas

 UNEXPECTED: the programmatic constraints cause the child to fill exactly
 1/4 of the screen (1/2 width, 1/2 height). The programmatic constraints
 work if I set the multiplier=2.0 on each of those constraints.

 I normally don't use width / height constraints this way but I'm surprised
 by the outcome. Is this a Retina pixels/points thing or am I doing
 something wrong?

 Thanks,
 -Luther


 //
 // 1. Fill the parent view with a simple, yellow container
 //
 _containerView = [[UIView alloc] init];
 _containerView.backgroundColor = [UIColor yellowColor];
 _containerView.translatesAutoresizingMaskIntoConstraints = NO;
 [self.view addSubview:_containerView];

 NSArray *cc = [NSLayoutConstraint constraintsWithVisualFormat:@
 V:|[container]|

 options:NSLayoutFormatAlignAllCenterX
   metrics:nil
 views:@{
 @container : _containerView }];
 [self.view addConstraints:cc];
 cc = [NSLayoutConstraint constraintsWithVisualFormat:@
 H:|[container]|

 options:NSLayoutFormatAlignAllCenterY
  metrics:nil
views:@{ @container
 : _containerView }];
 [self.view addConstraints:cc];

 //
 // 2. Add a red child to the aforementioned container view
 //

 UIView *childView = [[UIView alloc] init];
 childView.backgroundColor = [UIColor redColor];
 childView.translatesAutoresizingMaskIntoConstraints = NO;
 [_containerView addSubview:childView];

 // WORKS AS EXPECTED

 cc = [NSLayoutConstraint constraintsWithVisualFormat:@V:|[child]|

 options:NSLayoutFormatAlignAllCenterX
   metrics:nil
 views:@{
 @child : childView }];
 [_containerView addConstraints:cc];
 cc = [NSLayoutConstraint constraintsWithVisualFormat:@H:|[child]|

 options:NSLayoutFormatAlignAllCenterY
  metrics:nil
views:@{ @child :
 childView }];
 [_containerView addConstraints:cc];

 //
 // now, replace the VFL from above with this and the child view only fills
 1/4 of the screen
 //

 NSLayoutConstraint *c = [NSLayoutConstraint
 constraintWithItem:childView

 attribute:NSLayoutAttributeWidth

 relatedBy:NSLayoutRelationEqual

 toItem:_containerView

 attribute:NSLayoutAttributeWidth
 multiplier:1.0
   constant:0.0];
 [_containerView addConstraint:c];

 c = [NSLayoutConstraint constraintWithItem:childView
  attribute:NSLayoutAttributeHeight
  relatedBy:NSLayoutRelationEqual
 toItem:_containerView
  attribute:NSLayoutAttributeHeight
 multiplier:1.0
   constant:0.0];
 [_containerView addConstraint:c];


___

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

UIScrollView question

2014-07-26 Thread Luther Baker
I have a pretty good frames based background but I'd like to consider an
iPhone screen done with AutoLayout on a UIScrollView such that the bottom
UITextView grows vertically to fill the vertical space remaining from the
text view to the bottom of the device.

 UIScrollView parent 

[Label]

[TextField]

[Label]

[TextView]



So basically, without calculating and then setting the height explicitly,
how should the TextView be directed to vertically grow to fill the lower,
visible part UIScrollView?

Extra Credit: When the user taps into the UITextView, the
- keyboard comes up (free)
- the scroll view offset programmatically scrolls up = keyboard height
(keyboard notifications)
- the text view grows/shrinks to perfectly fill the area between the
keyboard top and the navigationbar bottom - remember, this has to work on
iPhone4 and 5.

I'm not sure how to manage that last step without digging in and
getting/setting some direct frame calculations which leads me to wonder if,
in this case, using AutoLayout would be like pushing a square peg into a
round hole.

Thanks in advance for any input,
-Luther


If it isn't already clear, the scroll view isn't really a key player until
the user actually taps into the text view in which case it simply tries to
bring the text view into focus while still allowing someone to, while in
the focus state, either scroll back up to the top text field and enter text
there or scroll to simply resign any existing focus.

Better ideas ... or different perspectives are welcome. I could imagine
affine changes or gesture recognizer based solutions for this effect before
but was thinking that leveraging the scroll view would be a natural.
___

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: UIScrollView question

2014-07-26 Thread Luther Baker
Yep - I'm good with the keyboard part (ie: I can tell how much of the
screen will disappear) ...

 won’t a “bottom space to superview”

Are you hoping that when the keyboard comes up -- it shortens the parent
view you are referring to? To date, that has not been my experience. The
keyboard just shows up on top of all the children views. If I went that
route I think I'd still have to calculate the change and set a new height
constraint ... which is getting into framesy land (which is OK, but not why
I'm explicitly trying to explore).

Also, in viewWillAppear, how shall I determine how large to make the text
view? Are you thinking get the height of the parent view and then
subtract the heights of all the children views and then set that constraint
on the text view? If so, that feels like frames code dressed up in
AutoLayout clothing.

Thanks,
-Luther



On Sat, Jul 26, 2014 at 11:17 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On Jul 26, 2014, at 21:09 , Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:

 Isn’t the answer to this …


 Sorry, I quoted the wrong thing. I meant, isn’t the answer to the stuff
 about the keyboard in that documentation?

 Is the scroll view there only to deal with the case of the keyboard
 appearing? In that case, won’t a “bottom space to superview” constraint do
 the right thing, or (if scroll views are one of those cases where the
 obvious thing doesn’t work) can’t you add a height constraint to the text
 view at viewWillAppear time?


___

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: UIScrollView contentSize question

2014-06-22 Thread Luther Baker
Yaay!


On Sun, Jun 22, 2014 at 12:10 AM, Kyle Sluder k...@ksluder.com wrote:

 On Jun 21, 2014, at 9:13 PM, Luther Baker lutherba...@gmail.com wrote:
 
  I want a 2-page horizontally scrolling UIScrollView on a simple
  UIViewController. Very similar to what Twitter does to swipe between
 Home,
  Discover and Activity views.
 
  Using storyboards, dropping a UIScrollView on a UIViewController is a
 piece
  of cake. Pinning the UIScrollView to the top and bottom layout guides -
  left and right parent view edges, piece of cake. I can paint the
 background
  bright green and see it just fine.
 
  What is the best way to layout the 'content' views? I want them to be the
  size of the UIScrollView's frame. Specifically, what is the best way to
 do
  this using AutoLayout?
 
  I know that Autolayout will cause the UIScrollView's contentSize to
 adjust
  to fit its child views ... so does that mean I need to create height and
  width constraints on the child views - ie: I need actual numerical
 values?

 Nope. You should be able to create an equal-width constraint between the
 scroll view and one of your page subviews. Then make the rest of your
 page subviews equal in width to the first one.

 You’ll also want to do this for the height.

 --Kyle Sluder

___

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: UIScrollView contentSize question

2014-06-22 Thread Luther Baker
I've got that working in code ... thoughts on how to do this with
storyboards? Or at least, I'd like to create the children views themselves
in the storyboard.

When I 'freeform' the view controller to allow me to show a UIScrollView
that is 2 pages wide, binding the first view to the width of the
scrollview (which is 720.0) and then pulling that view's display frame back
to half that (to place two children side by side) creates inconsistent
constraints wrt to the child view / scrollview widths.

( I followed a bit of what Rob talked about here
http://stackoverflow.com/questions/16889123/how-to-add-objects-to-a-uiscrollview-that-extend-beyond-uiview-from-storyboard/
and then watched a bit of his video here
https://www.youtube.com/watch?v=PgeNPRBrB18feature=youtu.be )


On Sun, Jun 22, 2014 at 6:52 PM, Luther Baker lutherba...@gmail.com wrote:

 Yaay!


 On Sun, Jun 22, 2014 at 12:10 AM, Kyle Sluder k...@ksluder.com wrote:

 On Jun 21, 2014, at 9:13 PM, Luther Baker lutherba...@gmail.com wrote:
 
  I want a 2-page horizontally scrolling UIScrollView on a simple
  UIViewController. Very similar to what Twitter does to swipe between
 Home,
  Discover and Activity views.
 
  Using storyboards, dropping a UIScrollView on a UIViewController is a
 piece
  of cake. Pinning the UIScrollView to the top and bottom layout guides -
  left and right parent view edges, piece of cake. I can paint the
 background
  bright green and see it just fine.
 
  What is the best way to layout the 'content' views? I want them to be
 the
  size of the UIScrollView's frame. Specifically, what is the best way to
 do
  this using AutoLayout?
 
  I know that Autolayout will cause the UIScrollView's contentSize to
 adjust
  to fit its child views ... so does that mean I need to create height and
  width constraints on the child views - ie: I need actual numerical
 values?

 Nope. You should be able to create an equal-width constraint between the
 scroll view and one of your page subviews. Then make the rest of your
 page subviews equal in width to the first one.

 You’ll also want to do this for the height.

 --Kyle Sluder



___

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

UIScrollView contentSize question

2014-06-21 Thread Luther Baker
I want a 2-page horizontally scrolling UIScrollView on a simple
UIViewController. Very similar to what Twitter does to swipe between Home,
Discover and Activity views.

Using storyboards, dropping a UIScrollView on a UIViewController is a piece
of cake. Pinning the UIScrollView to the top and bottom layout guides -
left and right parent view edges, piece of cake. I can paint the background
bright green and see it just fine.

What is the best way to layout the 'content' views? I want them to be the
size of the UIScrollView's frame. Specifically, what is the best way to do
this using AutoLayout?

I know that Autolayout will cause the UIScrollView's contentSize to adjust
to fit its child views ... so does that mean I need to create height and
width constraints on the child views - ie: I need actual numerical values?

If so, I clearly don't want to hard-code 320.0 as the width ... so is it
appropriate to CGRectGetWidth(scrollView.frame) or
CGRectGetHeight(scrollView.frame) and rely on frame or bounds values of
the parent to setup the autolayout stuff in the children? Clearly this can
only be done after the scrollView has loaded and positioned itself.

It feels weird to mix the two abstractions and have to wait until the
scrollview is positioned before creating the constraints on the children -
feels dangerous/brittle. Feels like I'll have to manually handle device
rotations, etc ???

Thanks,
-Luther
___

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

mavericks style tabs

2014-05-18 Thread Luther Baker
Trying my hand at some Cocoa development ... is there an SDK around the
tabs used in Finder or Safari?

If not, is there a popular library that folks are using (
https://github.com/rsms/chromium-tabs ?) or is this something folks are
generally building from ground up?

Thanks,
-Luther
___

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: mavericks style tabs

2014-05-18 Thread Luther Baker

  But you should tell us more so that we can get some additional information 
 and give better advice.

Sure. I'm writing a diagramming tool and I'd like multiple diagrams open 
simultaneously. Using the NSTabView and custom drawing as described seems like 
a viable option to me.
___

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: Good idea/bad idea?

2014-04-24 Thread Luther Baker
Not native and I've no idea when or if this is a good idea ... nor am I sure 
how much typing you want to do ... but you _could_ create a class convenience 
method for this

x = [Thing defaultIfNil:x];

With shorter or longer names as you see fit ... down to possibly:

x = [Thing :x]

I've really no idea if that syntax would work but it stands out and might be 
easy to use and identify in the code!

-Luther


 On Apr 24, 2014, at 9:33 AM, Alex Zavatone z...@mac.com wrote:
 
 I was just asked yesterday if there is any shorthand in Objective-C for if 
 this thing = nil, then instantiate a new instance from the class
 
 Something like this:
 
 NSString x;
 
 if ([x isEqualtoString:nil]) {
x = @yo;
 } 
 
 Feel free to replace NSString with any class.
 
 And we messed around a bit looking for any shorthand and though it looked 
 like a terrible idea since the comparison is done against integers using the 
 ternary operator, I'd like to know exactly why it's a terrible idea.
 
 NSString x;
 
 x = (x) ?: @yo;
 
 Thanks in advance.
 - Alex
 
 ___
 
 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/lutherbaker%40gmail.com
 
 This email sent to lutherba...@gmail.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

Navigation Design question

2014-04-13 Thread Luther Baker
Hello all,

I've run into an issue a few times and I'd like to see if someone has a
good design suggestion to address my problem.

Consider an iPad or iPhone application based on a UINavigationController -
that displays a 'menu' button in the UINavigationBar. The navbar renders
UIBarButtonItems ... which we set per the UIViewController level via the
UINavigationItem which is available to us via the UIViewController.

Now, I've got to render, for lack of a better term, a _global_ menu. I need
the exact same button to simply stick to the upper left or right hand side
of the nav bar. Consider that the button triggers the display of a
UIPopoverController with a tableview which again, has _global_ style
options. Specifically, and to keep the example simple, this menu has
nothing to do with the child view controller. Maybe menu options include
LOGOUT, or display SETTINGS or maybe there is an option to modally presents
a report.

How can I get this to show up - without forcing every single view
controller to _know_ about this global menu, jam it into their own
self.navigationItem.leftBarButtonItem property and be sure to register a
handler from somewhere to do the right thing.

What I think I _really_ want is a design wherein the view controller
essentially _asks_ the navigation controller to either (a) add a very
specific UIBarButtonItem to the navigation bar (which would allow the
navigation controller to add the button to an array if a global button
already existed) ... or (b) add a selection option - which the navigation
bar could decide how to handle (create a new button, or insert into an
existing menu, etc).

What makes rolling my own wrappers around this difficult is that those
things are set via the UINavigationItem - which is very very specific to
the view controller itself - it isn't directly available to the navigation
controller per se.

I'm leaning towards adding something like:

- (void)addBarButtonItem:(UIBarButtonItem *)barButtonItem
toNavigationItem:(UINavigationItem *)navigationItem;

- (void)addMenuOption:(idMenuOption)option
toNavigationItem:(UINavigationItem *)navigationItem;

to either a category or subclass of the UINavigationController I am using
to handle the case where I want to _add_ my requirements to whatever the
UINavigationController is already displaying ... the problem is, if a view
controller has _nothing_ to add to the nav bar, the global menu addition
wouldn't get triggered 

I wonder if I need to shift my focus to the UINavigationBar itself -- and
intercept calls trying to create buttons ... but that be new territory for
me as I've always just depended on the meta-informational style of using
the view controller's UINavigationItem.

Any thoughts on this? Has anyone discovered a better way to do this without
cluttering up every child view controller's SRP with the necessity to set
buttons for someone else while retaining ultimate flexibility to set their
own -- while still not having a way to 'insert' an option into an existing
partially _global_ menu that is floating from vc to vc.

I essentially don't want view controllers setting these items directly - I
want them to _add_ items - not _set_ them. And I'm not sure how to do this
within the design paradigm of the view controller's navigation item
instance - since that just puts me at one more level of direction (someone
else reads that object and then builds out the UINavigationBar accordingly).

Ok - getting wordy and repetitive. Hope I've said enough to be clear what
I'm trying to do.

Thanks,
-Luther
___

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 do you guys use to convert an XSD to objective C data classes/structures?

2014-03-25 Thread Luther Baker
 We have a lot of legacy systems at my latest gig that all use and output
XML data.

I remember building a few data-driven webpages completely in XML and XSLT
--- and I clearly remember thinking it was the _future_! :-)

I must admit up front that I'm not sure which general approach would be
best ... but some naive thoughts: it seems like you might be able to
leverage an XML to JSON conversion as JSON may be a bit more malleable in
Objective-C space.

Or, depending on the complexity of your project and the maturity of the
following - consider something like

http://code.google.com/p/xsd2cocoa/

or, write one and contribute it back to the community? :-)


On Tue, Mar 25, 2014 at 2:15 PM, Alex Zavatone z...@mac.com wrote:

 We have a lot of legacy systems at my latest gig that all use and output
 XML data.

 For the purpose of consuming server based XML files, we're looking for a
 method to automate creation of objective c classes that represent the
 internal XML data structure.

 Is there any compelling reason not to deserialize into dictionaries
 instead?

 Which approach do you guys use?

 Thanks in advance.

 - Alex Zavatone
 ___

 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/lutherbaker%40gmail.com

 This email sent to lutherba...@gmail.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: VC# vs. ObjC and partial abstract classes

2014-03-19 Thread Luther Baker
On Wed, Mar 19, 2014 at 12:14 AM, Sixten Otto hims...@sfko.com wrote:

 On Tue, Mar 18, 2014 at 7:29 PM, Luther Baker lutherba...@gmail.com
 wrote:

  A _better_ analogy to an Objective-C @protocol would be a formal Java
  interface.
 

 Sure. And the same in C# (which the OP was asking about).


Can't tell if you are agreeing with me or implying that I'm stating the
obvious.



  So, Kyle may have good reasons for his answer - but if I understand the
  essence of your question, I would say yes, a pure abstract class (where
  no methods are implemented) or a formal interface (where method
  signatures have no implementation) in a language like Java ... would both
  indeed be _similar_ to a formal @protocol in Objective-C.
 

 The significant difference, though, between an abstract class in Java or
 C#, and a protocol in Objective-C, is that the former may have substantial
 implementation associated with it for the benefit of subclasses, and just
 not be directly instantiable.


The original poster's first paragraph uses and defines the phrase partial
abstract class which is what you're describing here. I think we're all
good with what you're saying. But the point to which you are actually
responding to is in regard to a point I made in response to Kyle's
suggestion which had to do with the author's self described pure abstract
class which we can infer has NO implementation.

Your points are true - but I'm confused as to why you are replying with
them. They seem to be qualifying something? If you reread the responses
you'll see that we are very specifically talking about the case where NO
methods are implemented.

And more to the point, I think the original poster already knows what you
are saying. I think he is asking for thoughts regarding his approach to
simulating a notional Abstract Class via mix of @protocols and @classes in
Objective-C. He clearly knows he can't do it with @protocols alone.



 (Something like UIKit's UIResponder might be a good choice for this kind of
 thing, if Objective-C supported it: it provides a lot of common machinery
 you wouldn't want each conforming class to implement separately, but also
 isn't something you'd use on its own.)

 Another way that Objective-C accomplishes some of the same goals is through
 delegation. You don't, for instance, subclass a UITableView to provide its
 data, you provide a delegate that conforms to UITableViewDataSource; which
 protocol does have a couple of required methods.


___

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: VC# vs. ObjC and partial abstract classes

2014-03-19 Thread Luther Baker
 And more to the point, I think the original poster already knows what you
 are saying. I think he is asking for thoughts regarding his approach to
 simulating a notional Abstract Class via mix of @protocols and @classes in
 Objective-C. He clearly knows he can't do it with @protocols alone.


and of course I mean @protocols and @interfaces (and not @classes) ...
which begs an entirely different topic :-)
___

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: VC# vs. ObjC and partial abstract classes

2014-03-18 Thread Luther Baker
On Tue, Mar 18, 2014 at 8:11 PM, Kyle Sluder k...@ksluder.com wrote:

 On Tue, Mar 18, 2014, at 05:30 PM, William Squires wrote:
  Hi all!
Obviously (IIRC) a pure abstract class would map to a formal protocol
in ObjC (or a class interface in languages such as REALbasic/Xojo, or
VB 6). My best guess is to:

 No, that's not what protocols are for. Any class can conform to any
 protocol.


Mmmm ... well, generally speaking, any class can conform to any abstract
class as well. I believe that one distinction is that an Objective-C @class
can conform to an endless number of @protocols while a Java class can only
directly *subclass* ONE abstract class, pure or not. But similarly, in
Objective-C, a @class can subclass only one @class at a time.

A _better_ analogy to an Objective-C @protocol would be a formal Java
interface.

So, Kyle may have good reasons for his answer - but if I understand the
essence of your question, I would say yes, a pure abstract class (where
no methods are implemented) or a formal interface (where method
signatures have no implementation) in a language like Java ... would both
indeed be _similar_ to a formal @protocol in Objective-C.

And as I think I hear in your voice, the essence is that the interface,
pure abstract class or protocol ALL declare a formal contract or API that
some other concrete class implements, adopts or conforms to. Pick your
terms but indeed the language constructs you've listed here are, at some
level, analogous.

And yes, I think your Objective-C attempt to replicate the notion of an
abstract class in Java demonstrates an understanding of protocols and
classes in Objective-C. It is clearly a sort of blend of the two.

Hope that helps.
-Luther
___

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: disk operations - mounting images I've created manually via Disk Utility

2014-03-16 Thread Luther Baker
The NSWorkspace idea was a great suggestion. I'm actually using my first 
homegrown OSX app in my everyday work with that suggestion!!

I will continue to refine it ... I wonder though, if it is presumptuous to 
guess which apps Apple will continue to provide for use from my app. And, does 
OSX actually use Disk Utility or hdiutil to actually mount my bundles. I'm 
currently ok mounting dmgs or other image types via whatever mechanism the 
current OS or user preferences dictate so I may opt NOT to specify that in the 
call to open the file (admittedly I am pretty green in this space) ... but that 
said,

I think my next step in this app is to encapsulate a bit more sparse file image 
functionality in my simple app. Namely, I've come across some suggestions to 
wrap calls to hdiutil inside of NSTask as it seems that the DiskImage 
framework is still pretty private.

Per my original post, I think Disk Arbitration is quickly falling off the radar 
as a viable option for this work but maybe that will prove incorrect.

Nevertheless, I'm not sure how I feel about I the proposed call out to the OS 
type of programming for hdiutil type functionality. My app won't be able to 
stand on its own and I think I will feel beholden to Apple a bit.

Maybe hdiutil will forever be available ... Maybe DiskImage, or parts of it, 
will be made public. Either way, I think it is the only way to get the 
functionality I'm after next.

I wonder if it would be wise to consider wrapping calls to hdiutil inside of 
user space Apple script giving me some runtime flexibility?

Many thanks!
-Luther

 On Mar 16, 2014, at 4:13 PM, Michael Starke 
 michael.sta...@hicknhack-software.com wrote:
 
 What might be useful is to not rely on the default application and use 
 openURL:withApplication: to make sure Disk Utility mounts the image, not 
 another tool the user did associate with .dmgs or .sparsebundle
 
 
 On 16 Mar 2014, at 05:35, Luther Baker lutherba...@gmail.com wrote:
 
 Indeed!
 
 That works perfectly ... as also does its antithesis NSWorkspace 
 unmountAndEjectDeviceAtPath
 
 You are nothing short of a genius.
 
 
 
 On Sat, Mar 15, 2014 at 4:44 PM, Michael Starke 
 michael.sta...@hicknhack-software.com wrote:
 I might be missing something, but can't you just open the file with 
 [[NSWorkspace sharedWorkspace]openURL:fileURL]?
 
 ___m i c h a e l  s t a r k e
 geschäftsführer
 HicknHack Software GmbH
 www.hicknhack-software.com
 
 ___k o n t a k t
 +49 (170) 36 86 1 36
 cont...@hicknhack.com
 
 ___H i c k n H a c k S o f t w a r e G m b H
 geschäftsführer - maik lathan | andreas reischuck | michael starke
 bayreuther straße 32
 01187 dresden
 amtsgericht dresden HRB 30351
 sitz - dresden
 
 On 15.03.2014, at 21:56, Luther Baker lutherba...@gmail.com wrote:
 
 I'm an iOS developer talking a walk on the OSX side and have a question
 about programmatically mounting sparse bundles ... or really just any dmg.
 
 My experimental project is to write a little statusbar application to mount
 and unmount disk images. I've created a few of these images in my own
 Volumes directory as follows:
 
   /Users/me/Volumes/me.sparsebundle
 
 For the time being, I am hard-wiring logic in a menu selection handler to
 actually mount these objects.
 
 I've been digging into Disk Arbitration and I've come up with the following:
 
 - (IBAction)mountMe:(id)sender {
   DASessionRef sessionRef = DASessionCreate(kCFAllocatorDefault);
   CFURLRef volumeURLRef = (__bridge CFURLRef)[NSURL fileURLWithPath:@
 /Users/me/Volumes/me.sparsebundle];
   DADiskRef diskRef = DADiskCreateFromVolumePath(kCFAllocatorDefault,
 sessionRef, volumeURLRef);
   CFURLRef mountPath = NULL;
   DADiskMountOptions mountOptions = kDADiskMountOptionDefault;
   DADiskMountCallback mountCallback = NULL;
   void *context = NULL;
   DADiskMount(diskRef, mountPath, mountOptions, mountCallback, context);
   CFAllocatorDeallocate(kCFAllocatorDefault, diskRef);
   CFAllocatorDeallocate(kCFAllocatorDefault, sessionRef);
 }
 
 *ANY* suggestions, even tangental (especially around memory management) are
 fair game here. I'd appreciate any input as I'm just starting to read about
 allocation, etc.
 
 But more to the point, I don't think DADiskCreateFromVolumePath is what I
 want. It seems that DADiskRef is NULL when I run this. Clearly, the most
 intimidating method in there is DADiskCreateFromIOMedia ... and I'm afraid
 that is the one I'm going to have to use.
 
 And, am I really trying to mount a disk as Disk Arbitration understands
 it? I'm not yet dealing with things like fstab, etc which I know very
 little about -- but should I start digging that way? I did come across a
 nice github project http://tommetge.github.io/VolumeManager/ but
 
 unfortunately I can't actually find any methods in there to mount ... only
 things like umount or eject. Notably, the open source project does use
 'getmntinfo' which leads me to look at the BSD mount man page ... but I
 before going there I

disk operations - mounting images I've created manually via Disk Utility

2014-03-15 Thread Luther Baker
I'm an iOS developer talking a walk on the OSX side and have a question
about programmatically mounting sparse bundles ... or really just any dmg.

My experimental project is to write a little statusbar application to mount
and unmount disk images. I've created a few of these images in my own
Volumes directory as follows:

/Users/me/Volumes/me.sparsebundle

For the time being, I am hard-wiring logic in a menu selection handler to
actually mount these objects.

I've been digging into Disk Arbitration and I've come up with the following:

- (IBAction)mountMe:(id)sender {
DASessionRef sessionRef = DASessionCreate(kCFAllocatorDefault);
CFURLRef volumeURLRef = (__bridge CFURLRef)[NSURL fileURLWithPath:@
/Users/me/Volumes/me.sparsebundle];
DADiskRef diskRef = DADiskCreateFromVolumePath(kCFAllocatorDefault,
sessionRef, volumeURLRef);
CFURLRef mountPath = NULL;
DADiskMountOptions mountOptions = kDADiskMountOptionDefault;
DADiskMountCallback mountCallback = NULL;
void *context = NULL;
DADiskMount(diskRef, mountPath, mountOptions, mountCallback, context);
CFAllocatorDeallocate(kCFAllocatorDefault, diskRef);
CFAllocatorDeallocate(kCFAllocatorDefault, sessionRef);
}

*ANY* suggestions, even tangental (especially around memory management) are
fair game here. I'd appreciate any input as I'm just starting to read about
allocation, etc.

But more to the point, I don't think DADiskCreateFromVolumePath is what I
want. It seems that DADiskRef is NULL when I run this. Clearly, the most
intimidating method in there is DADiskCreateFromIOMedia ... and I'm afraid
that is the one I'm going to have to use.

And, am I really trying to mount a disk as Disk Arbitration understands
it? I'm not yet dealing with things like fstab, etc which I know very
little about -- but should I start digging that way? I did come across a
nice github project http://tommetge.github.io/VolumeManager/ but
unfortunately I can't actually find any methods in there to mount ... only
things like umount or eject. Notably, the open source project does use
'getmntinfo' which leads me to look at the BSD mount man page ... but I
before going there I want to make sure I'm not _supposed_ to do this in
within Disk Arbitration. There is a DADiskCreateFromBSDName which seems
like it might be similar?
Anyway, any thoughts on this? And in general, is this fundamental stuff
covered in exemplary fashion anywhere? Would the OSX Internals books I've
seen dive into this? I'm assuming that if I've encryped my sparsebundle
that I'd be prompted by the OS for my password, which is fine for my first
pass but I'd eventually like to subsume that logic within my app - if for
no other reason than to simply better understand the partition management
frameworks.

Thanks in advance for even 1 brief minute of your time. I'll begin trying
the alternatives mentioned above in Disk Arbitration.
-Luther
___

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

secure uitextfield is not secure

2014-03-05 Thread Luther Baker
I'm generally a big fan of Cocoa Touch - but why does the secure option
on a UITextField still display the character you are typing?

And, is there any way I can turn this off?

Its generally hard to get non-employee AD credentials created or to stand
up DEV Active Directory services ... so everywhere I've ever worked, folks
like me are always entering their real AD creds in the app during
development. This is embarrassing when you are pairing and even worse, was
in a demo today and the leader is asking everyone not to look while they
entered their AD credentials in front of a whole host of people.

I guess one could write something to work around this ... but does anyone
know if that is really necessary - and what would have motivated Apple to
implement textField.secureTextEntry this way ... or not provide a textField.
*really*SecureTextEntry option which would mask ALL the characters. Maybe
an option that doesn't even show how many # the user is actually typing.
I'm surely not counting 14+ characters anymore.

-Luther
___

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: secure uitextfield is not secure

2014-03-05 Thread Luther Baker
Yep - cool. I'm not too dismayed and take it as it comes but I'm just
seriously surprised. It seems like a very obvious use case.

Google Mail does email differently and I think they justify it by _selling_
you a different way to look at your email. I have a hard to rationalizing
this in a similar fashion.

 Because (in my own case) I'm incapable of typing a password correctly
using the on-screen keyboard unless I can see when I've pressed the wrong
key.

:) true. But I don't think this really justifies the decision. My daughter
dropped the iPad on her toe but I don't think that warrants rubber bumpers
on the device :)

Just say it out loud a few times ...

*passwords appear in plaintext as you type them ..*
*passwords appear in plaintext as you type them ..*
*passwords appear in plaintext as you type them ..*
*passwords appear in plaintext as you type them ..*

I guess this would be a good idea for hermits :)

 The only way to find out is to file a radar and see what comes out in iOS
8.

How very sad ... there should really be no way I could influence Apple in
this regard. IE: this isn't some elaborate, hard to define bug. This better
not be an accident that requires energy from someone as insignificant as me
 to ask that secure text fields not echo their contents in Plaintext.

I guess its no big deal when you think of the naive device use case - where
someone could simply watch your fingers type on the virtual keyboard ...
but demos are often on mirrored devices or sometimes use hardware keyboards
or are fired up the simulator and displayed on the big screen as the team
watches in earnest to see the week's progress.

Again, I'm OK with it. I like writing custom controls. Just find it
interesting ... there has to be _some_ reason we haven't uncovered yet :)
Wanted to see if anyone had an elegant solution or if I'd missed something
in the API.





On Wed, Mar 5, 2014 at 2:52 PM, Fritz Anderson fri...@manoverboard.orgwrote:

 On 5 Mar 2014, at 1:17 PM, Luther Baker lutherba...@gmail.com wrote:

  I'm generally a big fan of Cocoa Touch - but why does the secure option
  on a UITextField still display the character you are typing?

 Touch keyboards offer almost no user feedback compared to physical ones.
 The keys on the iPhone keyboard are, to my thinking, too small to operate
 reliably. My hands are on the clumsy side of normal, and my error rate on
 the iPhone is about 10-20%. Left blind, there's no way I could ever enter a
 correct password.

  And, is there any way I can turn this off?

 I'd be surprised. iOS meets the (low-level, but nontrivial) security
 standards of a number of governments, and if I owned UITextInputField, the
 fewer hooks into password security, the better.

 At least, I don't see any such hook in the API. File a radar.

  Its generally hard to get non-employee AD credentials created or to stand
  up DEV Active Directory services ... so everywhere I've ever worked,
 folks
  like me are always entering their real AD creds in the app during
  development. This is embarrassing when you are pairing and even worse,
 was
  in a demo today and the leader is asking everyone not to look while
 they
  entered their AD credentials in front of a whole host of people.

 At an institution with HIPAA/FERPA/national-security exposure, exposing
 live credentials to development, much less demos, is a felony waiting to
 happen. I'm trying to swear off of impugning others' professionalism (and I
 have no reason to impugn yours), but if software development is part of the
 company mission, it's the admin's job to support that mission.

 My long-run strategy would be to escalate the matter on my management
 chain. If there is a privacy/security organization, let them know the risks
 of the current situation in the most gruesome terms you can muster.

  I guess one could write something to work around this ...

 People have tried to implement text field look-alikes (or heavily hooked
 text fields) that sort-of do what you want, but it's easier said than done.
 It's close to a from-scratch proposition. And, Apple is always going to
 provide a better, more-secure password (or even plain-text) field than you
 can build for yourself. There's more to security than screen appearance.

 I understand what you're saying, and I sympathize, but I don't _think_
 Apple is going to make it a priority to help you. Apple will argue that it
 can't assume the user's responsibility to keep live assets off projection
 screens, and to look over his shoulder before entering a password.

 The only way to find out is to file a radar and see what comes out in iOS
 8. In the mean time, yeah, you'll have to use the delegate methods to
 hot-swap bullets for typed characters.

  but does anyone
  know if that is really necessary - and what would have motivated Apple to
  implement textField.secureTextEntry this way ... or not provide a
 textField.
  *really*SecureTextEntry option which would mask ALL the characters. Maybe

Re: secure uitextfield is not secure

2014-03-05 Thread Luther Baker
Hey -- this is all good stuff!

I'm definitely a bit less cynical about this topic now.

Thanks for the virtual turn-around!




On Wed, Mar 5, 2014 at 5:41 PM, Kyle Sluder k...@ksluder.com wrote:

 On Wed, Mar 5, 2014, at 02:57 PM, Quincey Morris wrote:
  I agree with the earlier post which said (more or less) that if it's your
  job to demo stuff, then it's also your (your company's) responsibility to
  provide a non-secure demo platform, or a non-secure account.

 Take Luther's app out of the equation.

 Due to plenty of circumstances beyond the control of the user (timeouts,
 etc.), it may be necessary to reauthorize to some service during the
 course of presenting data via AirPlay. There is *no way* to securely use
 passwords in combination with AirPlay.

 This is a design problem that falls under the same umbrella as bad
 defaults. The user can optionally cancel whatever password prompt has
 appeared (and keep canceling if the software in question persists in its
 demand), disconnect from AirPlay, enter the password, reconnect to
 AirPlay, and return to the place they left off.

 But that's cumbersome. Instead, the software encourages the user to
 enter their password live and on the air.

 As I opined in an earlier thread, when AirPlay is engaged
 UISecureTextField should disable echo of the last character. Thanks
 Quincey for reminding me that the balloon keycaps should also be
 disabled.

 --Kyle Sluder

___

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: Validation of fields in a navigation stack

2014-01-09 Thread Luther Baker
Create your own UIBarButtonItem button ... set it on the navigation item's 
leftBarButton property. Do what you want when they tap it with your own handler.

The left bar button will cover the back button.

 On Jan 9, 2014, at 6:22 PM, Rick Mann rm...@latencyzero.com wrote:
 
 What's the right way to validate fields in an editable detail view in a 
 navigation stack? It seems that the API doesn't really provide a good means 
 to do so without a lot of contortions, and so I wonder what the intended 
 behavior is.
 
 Here's what I've got: A UINavigationController stack with a UITableView that 
 shows a list of Jobs. You can add a new job, or select an existing job, and 
 it pushes a new UITableViewController that is a detail view of the Job. Some 
 of the fields in this detail view are editable (i.e. Name).
 
 I don't want to allow the user to specify an empty name. So I had a separate 
 Save button in the top-right of the nav bar, and I would validate 
 everything in there before actually saving the changes to Core Data. I also 
 had to subclass UINavigationController to prompt the user to discard changes 
 if they tapped the back button (I also had to do this if they did something 
 else to dismiss the UIPopover all this lives in).
 
 For other reasons, I'd like to change this behavior a bit to avoid the save 
 step all together, and to always save any change. But I still need to 
 validate that they don't try to save an empty name. I'm trying to do this 
 with -[UITextFieldDelegate textFieldShouldEndEditing:], in which I present an 
 alert and return NO if the field is empty. But that doesn't work if they tap 
 the back button. In this case, I'm content with simply undoing whatever 
 change they made and not saving the changes without prompting, but I have to 
 be able to detect that that's what's happening. There is no 
 UINavigationControllerDelegate method for popping a view controller, only 
 showing a new one.
 
 I guess I could set a flag in -viewWillDisappear: indicating that the field 
 is ending editing because the view is going away, and save or discard 
 (without an alert) in that case.
 
 What are your thoughts?
 
 -- 
 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/lutherbaker%40gmail.com
 
 This email sent to lutherba...@gmail.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: iPad keyboards

2013-12-17 Thread Luther Baker
On Thu, Dec 12, 2013 at 3:08 PM, Rick Mann rm...@latencyzero.com wrote:


 That's good to know; I thought they were requiring iOS 7.


https://developer.apple.com/news/index.php?id=12172013a#top


 Even so, does an iOS 6 SDK-based app not get all iOS 7 styling? I'd try
 the experiment myself, but it's a bit of work to install Xc 4.6.3.


http://stackoverflow.com/questions/18423896/is-it-possible-to-install-ios-6-sdk-on-xcode-5
http://stackoverflow.com/questions/11424920/how-to-point-xcode-to-my-10-6-sdk-so-it-can-be-used-as-a-base-sdk/11424966

Good times ;)
-Luther
___

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: iPad keyboards

2013-12-12 Thread Luther Baker


On Dec 12, 2013, at 3:38 AM, Rick Mann rm...@latencyzero.com wrote:

 I thought you had to use Xcode 5 to submit now,

Xcode 5 can build with the 6 SDK.

 and I thought it had to be linked against iOS 7.

Dunno 

 I'm pretty sure Apple rejected one of my binaries because of that.
 

Might try to clarify for which reason it was rejected. They are orthogonal.

 On Dec 12, 2013, at 01:34 , Kyle Sluder k...@ksluder.com wrote:
 
 On Dec 11, 2013, at 9:49 PM, Rick Mann rm...@latencyzero.com wrote:
 
 
 They released the latest version of their app Nov 19. They would've had to 
 build against the iOS 7 SDK.
 
 As far as I know, Apple is still accepting binaries linked against the iOS 6 
 SDK.
 
 --Kyle Sluder
 
 
 -- 
 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/lutherbaker%40gmail.com
 
 This email sent to lutherba...@gmail.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

Autolayout Freespace

2013-12-11 Thread Luther Baker
Is there a way autolayout can be told to proportionally divide available
free space amongst a set of views?

For example (please ignore the actual 'VFL' and consider the following
horizontal layout string as pseudo code):

H:|-[FirstName]-[LastName]-[SocialSecurity]-[Birthday]-[Age]-|

Assume that each control hugs its own content tightly and that in the
simple case, the initial display ends up requiring only 50% of the
available parent view width.

Can I set up the constraints so that the remaining space is divided up
according to some user-defined relative weighting mechanism? IE: I want the
FirstName and LastName textfields to grow - receiving 20% each of the
remaining space with the Birthday button then getting the final extra 10%?

Using resistance and hugging properties, I know how to make 1 control
receive all the extra space  ... but I don't know how to balance free space
across several controls.
___

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: Autolayout Freespace

2013-12-11 Thread Luther Baker
Thanks - and yeah, I'm trying to avoid calculation.

And just to clarify, if I need to do some manual calculation, would I be
using frames, etc? Frame feels like such a dirty word in autolayout
world; is there something else specific to autolayout (like intrinsic size
- obviously not in this case) ...

Also, if I need to do some manual calculation, would I do that in the
view's layoutSubviews - and would I remove and create constraints in that
method also - and then tell them to lay themselves out again from that
method as well?

Back to the original question, do I misunderstand priorities? Can these act
as weights at all ... or does the highest priority just win?

Thanks.



On Wed, Dec 11, 2013 at 11:28 PM, dangerwillrobinsondan...@gmail.comwrote:



 Sent from my iPhone

  On 2013/12/12, at 13:50, Luther Baker lutherba...@gmail.com wrote:
 
  Is there a way autolayout can be told to proportionally divide available
  free space amongst a set of views?
 
  For example (please ignore the actual 'VFL' and consider the following
  horizontal layout string as pseudo code):
 
 H:|-[FirstName]-[LastName]-[SocialSecurity]-[Birthday]-[Age]-|
 
  Assume that each control hugs its own content tightly and that in the
  simple case, the initial display ends up requiring only 50% of the
  available parent view width.
 
  Can I set up the constraints so that the remaining space is divided up
  according to some user-defined relative weighting mechanism? IE: I want
 the
  FirstName and LastName textfields to grow - receiving 20% each of the
  remaining space with the Birthday button then getting the final extra
 10%?
 
  Using resistance and hugging properties, I know how to make 1 control
  receive all the extra space  ... but I don't know how to balance free
 space
  across several controls.
 So this is where you might use long form.
 But basic thing is you need to calculate. Then set the metrics. Of course
 you might need to do some KVO or other means of keeping in sync with
 resizing.

 You might also just consider NSStackView designed for this purpose.

  ___
 
  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/m

___

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: iPad keyboards

2013-12-11 Thread Luther Baker
Technically, an iPad running iOS7 can run apps in iOS6 compatibility mode.

The keyboard is a dead giveaway.

It is similar to an original OSX upgrade from OS9, where some OS9 apps
could run within OSX under an OS9 compatibility mode. Or think of it like
running a windows app in Parallels on a Mac.

If an app is running in iOS6 compatibility mode, some of the controls you
will see (like the alert view) will look like iOS7 - but alas, an iOS6
keyboard showing up on an iOS7 device is a dead giveaway that the app was
built with iOS6 SDK ... which automatically runs on the iOS7 device in iOS6
compatibility mode.

The key, you must build your app with the iOS6 SDK. That means ... Xcode
4.3 ... or download an older version of Xcode and copy the 6 SDK into your
Xcode 5.

In general, not everything works perfectly in iOS6 compatibility mode - so
be sure and do some testing ... but for instance, it allows my
existing apphttps://itunes.apple.com/tc/app/bliki-wiki/id623149294?mt=8
released
May 2013 to continue to function and run on iOS7 devices without requiring
an updated binary from me.


On Wed, Dec 11, 2013 at 11:47 PM, Maxthon Chan xcvi...@me.com wrote:

 The other way around - they styled their UI in iOS 7 fashion but used iOS
 6 SDK. It is actually quite simple if you ignore the blur effect.

 And I used to do that as well - when I worked for a game company and
 designed a UIKit-only game imitating iOS 7 looks on iOS 6 SDK.

 On Dec 12, 2013, at 13:44, Rick Mann rm...@latencyzero.com wrote:

  I'm running iOS 7. You're saying they styled their own keyboard to look
 like the iOS 6 keyboard? It's a pretty good imitation.
 
  On Dec 11, 2013, at 21:29 , Maxthon Chan xcvi...@me.com wrote:
 
  They simulated iOS 7 looks using iOS 6 SDK. It is not that difficult by
 using appearance proxy.
 
  On Dec 12, 2013, at 13:26, Rick Mann rm...@latencyzero.com wrote:
 
  Why does the Google Hangouts app on iPad, on iOS 7, have a
 nice-looking iOS-6 style keyboard? Other UI in the app looks like iOS 7 UI.
 
  Hangouts: http://cl.ly/image/1U2T1e1y1G15
  Safari:   http://cl.ly/image/2C1B2r2n2J3J
 
  --
  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/xcvista%40me.com
 
  This email sent to xcvi...@me.com
 
 
 
  --
  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/lutherbaker%40gmail.com

 This email sent to lutherba...@gmail.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

Autolayout Greedy Fill question

2013-12-04 Thread Luther Baker
Given the following controls:

lastName = text field
gender = segmented control
picture = image view

and given the following layout string:

@V:|-[lastName]-[gender]-[picture]-|;

I'd like to make sure that the lastName and gender controls are sized
tightly and allows the picture control fill all remaining vertical space.

Obviously, I don't want to include explicit size values.

In other words, I want sizing similar to old school [lastName sizeToFit]
and [gender sizeToFit] ... and then simply give the rest of the space to
'picture'.

This question goes for the H axis as well. I have a series of elements on a
line and I want to make sure that all of them are sized tightly save for
one which should greedily take up the rest of the space.

Please note that for the most part, these are built in controls - IE: I'm
not overriding or implementing intrinsic size details.

-Luther
___

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

  1   2   >