Re: Enabling UISearchBar cancel button?

2017-01-12 Thread Gary L. Wade
Your experience mirrors my own.  Look at what I wrote, and you should be closer 
to your goals.  I was also using a customized refresh control, and it appears 
sufficiently correct when pulling, between the search bar and collection view.  
You might need to adjust some values for your needs, though.
--
Gary L. Wade
http://www.garywade.com/ 
> On Jan 12, 2017, at 12:57 PM, Rick Mann  wrote:
> 
> I need my search bar to appear under the nav bar. We also have an extra view 
> outside and above the collection view. On top of that, I don't create a new 
> view for the results, but rather use the existing view. Once the user selects 
> an item that causes a push, and then goes back, everything is wonky. This is 
> in part due to a modal presentation of the search controller. I tried to 
> change that, but I could not get the UISearchBar to present the way I wanted 
> to (inserting it into the view hierarchy and adding constraints just didn't 
> seem to work right)
> 
> Now that I control the UISearchBar, it's always there, and all I do is adjust 
> the top constraint constant. The only problem is that the cancel button 
> behaves differently.
> 
> I'm going to try to explicitly set focus in the search field.
> 
>> On Jan 12, 2017, at 08:52 , Gary L. Wade  
>> wrote:
>> 
>> In what way is its controller getting in the way? Those do a lot together. 
>> If used with a collection view, you might find my solution helps:
>> 
>> https://whatweretheythinkingblog.wordpress.com/2016/11/19/effectively-using-uisearchcontroller-with-uicollectionview/
>> --
>> Gary L. Wade (Sent from my iPad)
>> http://www.garywade.com/
>> 
>> On Jan 11, 2017, at 8:17 PM, Rick Mann  wrote:
>> 
>>> I'm creating and displaying a UISearchBar without using UISearchController 
>>> (it gets in the way).
>>> 
>>> My UISearchBar is installed in the storyboard via IB. I animate it into 
>>> position in my UI when the user taps a button. However, the Cancel button 
>>> is disabled. I pre-load the search bar with the text of the last search, so 
>>> the button should be enabled.
>>> 
>>> Before, when I was using UISearchController, it was enabled. Now it's not, 
>>> until the user taps on it!
>>> 
>>> Any idea how to enable it? Thanks!
>>> 
>>> -- 
>>> Rick Mann
>>> rm...@latencyzero.com
>>> 
> 
> 
> -- 
> Rick Mann
> rm...@latencyzero.com
> 
> 

___

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

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

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

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


Re: Enabling UISearchBar cancel button?

2017-01-12 Thread Rick Mann
I need my search bar to appear under the nav bar. We also have an extra view 
outside and above the collection view. On top of that, I don't create a new 
view for the results, but rather use the existing view. Once the user selects 
an item that causes a push, and then goes back, everything is wonky. This is in 
part due to a modal presentation of the search controller. I tried to change 
that, but I could not get the UISearchBar to present the way I wanted to 
(inserting it into the view hierarchy and adding constraints just didn't seem 
to work right)

Now that I control the UISearchBar, it's always there, and all I do is adjust 
the top constraint constant. The only problem is that the cancel button behaves 
differently.

I'm going to try to explicitly set focus in the search field.

> On Jan 12, 2017, at 08:52 , Gary L. Wade  wrote:
> 
> In what way is its controller getting in the way? Those do a lot together. If 
> used with a collection view, you might find my solution helps:
> 
> https://whatweretheythinkingblog.wordpress.com/2016/11/19/effectively-using-uisearchcontroller-with-uicollectionview/
> --
> Gary L. Wade (Sent from my iPad)
> http://www.garywade.com/
> 
> On Jan 11, 2017, at 8:17 PM, Rick Mann  wrote:
> 
>> I'm creating and displaying a UISearchBar without using UISearchController 
>> (it gets in the way).
>> 
>> My UISearchBar is installed in the storyboard via IB. I animate it into 
>> position in my UI when the user taps a button. However, the Cancel button is 
>> disabled. I pre-load the search bar with the text of the last search, so the 
>> button should be enabled.
>> 
>> Before, when I was using UISearchController, it was enabled. Now it's not, 
>> until the user taps on it!
>> 
>> Any idea how to enable it? Thanks!
>> 
>> -- 
>> Rick Mann
>> rm...@latencyzero.com
>> 


-- 
Rick Mann
rm...@latencyzero.com



___

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

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

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

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


Re: Refreshing Cocoa Bindings

2017-01-12 Thread Gordon Apple
Just don't try binding to an arrayController via representedObject. I've
resorted to using representedObject to establish a local iVar to reference
such an arrayController. That works.


On 1/12/17 1:42 PM, "cocoa-dev-requ...@lists.apple.com"
 wrote:

> 
On Jan 11, 2017, at 13:16 , Daryle Walker  wrote:
> 
> I'm
> going to store a reference to a model in a NSViewController's
> representedObject field. The various contained views will reference that field
> through KVO (Is that possible?) for their bound values. If I change the value
> of the represented object (what it points to, not any attributes within), will
> the views automatically track to the new object? Or do I have to use a
> explicit method to let them know (i.e. clear their caches)?

The
> ³representedObject² property is explicitly documented as KVO compliant, so you
> can observe and and bind through it.





___

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: Opposite of windowDidLoad

2017-01-12 Thread Charles Srstka
> On Jan 12, 2017, at 12:53 PM, Quincey Morris 
>  wrote:
> 
> windowWillClose is an acceptable place to tear down the binding only if (a) 
> the thing bound, and the thing bound to, still exist, and (b) there is no 
> chance that the window will be re-opened. Both of those are typically true, 
> but it does depend on what you’re doing.
> 
> Window dealloc/deinit is also a possible time, but again you need to be sure 
> that the relevant objects still exist, probably by keeping strong references 
> to them in the window controller itself (and again it depends on what you’re 
> doing).

The nice thing about windowWillClose for this is that if the binding ends up 
retaining your window controller somehow, you don’t end up with a retain cycle.

Charles

___

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

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

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

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

Re: Opposite of windowDidLoad

2017-01-12 Thread Quincey Morris
On Jan 12, 2017, at 03:46 , Daryle Walker  wrote:
> 
> I was thinking of adding a Cocoa Binding during my window-controller's 
> did-load method. But where would the unbinding go?

You’re sort of asking the wrong question. The time to bind or unbind is 
dependent on the thing being bound and the thing being bound to. You must 
establish the binding after both things have been created, and tear down the 
binding before either thing is destroyed.

Note that windowDidLoad is a place where things like this are often done, 
because it happens at a time where you know that everything in the window that 
comes from a NIB file has been loaded and therefore exists.

> I see waiting until deinit or implementing NSWindowDelegate and using 
> windowWillClose.

Quibble: you *conform to* NSWindowDelegate (all of its methods are optional, so 
you can conform to it without implementing anything in it), and you *implement* 
windowWillClose (or not, since it is optional).

windowWillClose is an acceptable place to tear down the binding only if (a) the 
thing bound, and the thing bound to, still exist, and (b) there is no chance 
that the window will be re-opened. Both of those are typically true, but it 
does depend on what you’re doing.

Window dealloc/deinit is also a possible time, but again you need to be sure 
that the relevant objects still exist, probably by keeping strong references to 
them in the window controller itself (and again it depends on what you’re 
doing).

> Is there a similar access point for view-controllers?

Not for tearing down the binding. viewDidLoad is provided for you at the 
completion of NIB loading, for the same reason as windowDidLoad: because it’s 
hard otherwise for your code to know when NIB loading is complete without being 
told. For the opposite action, you can do it at dealloc/deinit as above.


___

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: Enabling UISearchBar cancel button?

2017-01-12 Thread Gary L. Wade
In what way is its controller getting in the way? Those do a lot together. If 
used with a collection view, you might find my solution helps:

https://whatweretheythinkingblog.wordpress.com/2016/11/19/effectively-using-uisearchcontroller-with-uicollectionview/
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Jan 11, 2017, at 8:17 PM, Rick Mann  wrote:
> 
> I'm creating and displaying a UISearchBar without using UISearchController 
> (it gets in the way).
> 
> My UISearchBar is installed in the storyboard via IB. I animate it into 
> position in my UI when the user taps a button. However, the Cancel button is 
> disabled. I pre-load the search bar with the text of the last search, so the 
> button should be enabled.
> 
> Before, when I was using UISearchController, it was enabled. Now it's not, 
> until the user taps on it!
> 
> Any idea how to enable it? Thanks!
> 
> -- 
> Rick Mann
> rm...@latencyzero.com
> 
___

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

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

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

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


Re: Opposite of windowDidLoad

2017-01-12 Thread Sandor Szatmari
If the window has the same lifespan as the controller, why not dealloc?  
Otherwise, wherever your closing your window.

Sandor

> On Jan 12, 2017, at 06:46, Daryle Walker  wrote:
> 
> I was thinking of adding a Cocoa Binding during my window-controller's 
> did-load method. But where would the unbinding go? I see waiting until deinit 
> or implementing NSWindowDelegate and using windowWillClose.
> 
> Is there a similar access point for view-controllers?
> 
> Sent from my iPhone
> ___
> 
> 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/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@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


Opposite of windowDidLoad

2017-01-12 Thread Daryle Walker
I was thinking of adding a Cocoa Binding during my window-controller's did-load 
method. But where would the unbinding go? I see waiting until deinit or 
implementing NSWindowDelegate and using windowWillClose.

Is there a similar access point for view-controllers?

Sent from my iPhone
___

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