UISplitviewController with master view controller hierarchy

2016-12-30 Thread Donald Hall
Hi all,

I have a master-detail iPad app with a hierarchy of table view controllers in 
the master view controller side of a split view controller. When the app starts 
in portrait mode the back button on the detail view navigation bar correctly 
shows the title of the initial table view controller (“Subjects”). When I tap 
on the button the Subjects tableview slides into view - i.e. the master view 
appears. I then select a row in the table to push the next table view 
controller (via segue) in the master view controller hierarchy 
(title=“Scales”). The back button on the MVC side is correctly titled 
“Subjects”. I now select a row in the “Scales” table which triggers a segue to 
the detail view controller’s navigation controller. The master view slides away 
to reveal the detail view. However, the back button on the DVC reads “Subjects” 
instead of “Scales” as it should. Tapping on the button correctly causes the 
“Scales” list to re-appear.

How can I get the correct title for the back button on the detail view 
navigation bar for the second (“Scales”) table view? In my prepareForSegue 
method in the Scales view controller I have these lines:

detailViewController.navigationItem.leftBarButtonItem = 
appDelegate.splitViewController.displayModeButtonItem;

detailViewController.navigationItem.leftItemsSupplementBackButton = YES;

I has assumed the displayModeButtonItem title would be updated when the master 
view controller was pushed, but apparently not.

Any suggestions would be much appreciated. Any examples I could find always 
only have a single master view controller.

Thanks,

Don Hall



Apps & More Software Design, Inc.
http://www.appsandmore.com
d...@appsandmore.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: My app only shows a black screen in the recent apps list

2016-12-30 Thread Carl Hoefs

> On Dec 30, 2016, at 4:00 PM, Quincey Morris 
>  wrote:
> 
> On Dec 30, 2016, at 13:58 , Carl Hoefs  > wrote:
>> 
>> UIApplicationExitsOnSuspend is useful for multi-user professional apps (such 
>> as medical apps associated with hardware). Otherwise there is the potential 
>> of a different user reactivating the app without having to log into it, and 
>> thus gaining access to private information.
> 
> This makes no sense to me. You could implement 
> application-logs-out-on-suspend behavior yourself. I can’t see any added 
> value in making the process quit too.
> 
> Secondarily, this isn’t very secure in itself. There is also the potential of 
> the current user walking away from the iOS device, leaving the app in the 
> foreground. Presumably, you *also* rely on an activity timeout to trigger a 
> log-out, and in that case it’s not clear what added value you get from 
> logging out on suspend.
> 
I didn't mean to imply that that's the only mechanism at play. Just that it's a 
useful one.
-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/archive%40mail-archive.com

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

Re: My app only shows a black screen in the recent apps list

2016-12-30 Thread Andreas Falkenhahn
On 31.12.2016 at 00:00 Quincey Morris wrote:

> On Dec 30, 2016, at 13:58 , Carl Hoefs
>  wrote:

>> UIApplicationExitsOnSuspend is useful for multi-user professional apps (such 
>> as medical apps associated with hardware). Otherwise there is the potential 
>> of a different user reactivating the app without having to log into it, and 
>> thus gaining access to private information.

> This makes no sense to me.

Call me old school, but to me being able to completely close a piece
of software is the most natural, most common sensical thing in the
world, like turning off my car or locking my house's front door. I've
never really understood why on mobile platforms closable apps have
suddenly become "exotic" or even evil. But I'm sure the powers that
be have some rational explanation for this decision. ;-)

$0.02

-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.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: My app only shows a black screen in the recent apps list

2016-12-30 Thread Quincey Morris
On Dec 30, 2016, at 13:58 , Carl Hoefs  wrote:
> 
> UIApplicationExitsOnSuspend is useful for multi-user professional apps (such 
> as medical apps associated with hardware). Otherwise there is the potential 
> of a different user reactivating the app without having to log into it, and 
> thus gaining access to private information.

This makes no sense to me. You could implement application-logs-out-on-suspend 
behavior yourself. I can’t see any added value in making the process quit too.

Secondarily, this isn’t very secure in itself. There is also the potential of 
the current user walking away from the iOS device, leaving the app in the 
foreground. Presumably, you *also* rely on an activity timeout to trigger a 
log-out, and in that case it’s not clear what added value you get from logging 
out on suspend.

___

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: My app only shows a black screen in the recent apps list

2016-12-30 Thread Carl Hoefs

> On Dec 30, 2016, at 12:34 PM, David Duncan  wrote:
> 
> Honestly, just remove UIApplicationExistsOnSuspend. Its simply not a behavior 
> that is expected of modern iOS applications.

True in general, but UIApplicationExitsOnSuspend is useful for multi-user 
professional apps (such as medical apps associated with hardware). Otherwise 
there is the potential of a different user reactivating the app without having 
to log into it, and thus gaining access to private information.


___

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: Animating autolayout constraint changes for subviews

2016-12-30 Thread Doug Hill

> On Dec 30, 2016, at 11:56 AM, David Duncan  wrote:
> 
> 
>> On Dec 30, 2016, at 11:50 AM, Doug Hill  wrote:
>> 
>> 
>>> On Dec 30, 2016, at 11:38 AM, David Duncan  wrote:
>>> 
>>> 
 On Dec 28, 2016, at 4:14 PM, Doug Hill  wrote:
 
 Hi Ken,
 
 The exact behavior is that the label will resize to the new size 
 immediately and reflow the text, then the container view will animate it's 
 size change. It would be nice if both the label and the container view 
 animate at the same time.
 Also, as I mentioned, a button will exhibit the same behavior, probably 
 because it has a UILabel inside it to show the button text.
>>> 
>>> Labels (and other content provided via -drawRect:) will almost universally 
>>> behave this way without additional work on your part, as the content is 
>>> redrawn instantly at the final size. At best you might get an animation 
>>> where the content resizes into place, but more often than not, it will pop 
>>> in some undesirable way. Generally the only way to get good animations with 
>>> drawn content is to snapshot in some way and execute an custom animation 
>>> from the old to the new content (snapshotting isn’t necessarily literal 
>>> here – it can just mean creating a new label with the new content as one 
>>> example).
>> 
>> David,
>> 
>> Thanks for the info. I’m curious what system views with content are 
>> animatable. I guess UIImageView works for the snapshots. But anything with a 
>> label is out. I’ll do some tests and see what works.
> 
> They are all “animatable”, but the results are not necessarily well defined. 
> Most system controls use combinations of image views and labels for images 
> and text content, so the resizing animations are often going to be based on 
> how -drawRect: content resizes.

Right, “animatable” in the sense that I won’t need to do a snapshot trick.

Working on the snapshotting now, appreciate the tips.

Doug Hill


___

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

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

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

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

Re: Animating autolayout constraint changes for subviews

2016-12-30 Thread David Duncan

> On Dec 30, 2016, at 11:50 AM, Doug Hill  wrote:
> 
> 
>> On Dec 30, 2016, at 11:38 AM, David Duncan  wrote:
>> 
>> 
>>> On Dec 28, 2016, at 4:14 PM, Doug Hill  wrote:
>>> 
>>> Hi Ken,
>>> 
>>> The exact behavior is that the label will resize to the new size 
>>> immediately and reflow the text, then the container view will animate it's 
>>> size change. It would be nice if both the label and the container view 
>>> animate at the same time.
>>> Also, as I mentioned, a button will exhibit the same behavior, probably 
>>> because it has a UILabel inside it to show the button text.
>> 
>> Labels (and other content provided via -drawRect:) will almost universally 
>> behave this way without additional work on your part, as the content is 
>> redrawn instantly at the final size. At best you might get an animation 
>> where the content resizes into place, but more often than not, it will pop 
>> in some undesirable way. Generally the only way to get good animations with 
>> drawn content is to snapshot in some way and execute an custom animation 
>> from the old to the new content (snapshotting isn’t necessarily literal here 
>> – it can just mean creating a new label with the new content as one example).
> 
> David,
> 
> Thanks for the info. I’m curious what system views with content are 
> animatable. I guess UIImageView works for the snapshots. But anything with a 
> label is out. I’ll do some tests and see what works.

They are all “animatable”, but the results are not necessarily well defined. 
Most system controls use combinations of image views and labels for images and 
text content, so the resizing animations are often going to be based on how 
-drawRect: content resizes.

> 
> Doug Hill

--
David Duncan


___

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: Animating autolayout constraint changes for subviews

2016-12-30 Thread Doug Hill

> On Dec 30, 2016, at 11:38 AM, David Duncan  wrote:
> 
> 
>> On Dec 28, 2016, at 4:14 PM, Doug Hill  wrote:
>> 
>> Hi Ken,
>> 
>> The exact behavior is that the label will resize to the new size immediately 
>> and reflow the text, then the container view will animate it's size change. 
>> It would be nice if both the label and the container view animate at the 
>> same time.
>> Also, as I mentioned, a button will exhibit the same behavior, probably 
>> because it has a UILabel inside it to show the button text.
> 
> Labels (and other content provided via -drawRect:) will almost universally 
> behave this way without additional work on your part, as the content is 
> redrawn instantly at the final size. At best you might get an animation where 
> the content resizes into place, but more often than not, it will pop in some 
> undesirable way. Generally the only way to get good animations with drawn 
> content is to snapshot in some way and execute an custom animation from the 
> old to the new content (snapshotting isn’t necessarily literal here – it can 
> just mean creating a new label with the new content as one example).

David,

Thanks for the info. I’m curious what system views with content are animatable. 
I guess UIImageView works for the snapshots. But anything with a label is out. 
I’ll do some tests and see what works.

Doug Hill
___

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

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

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

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

Re: Animating autolayout constraint changes for subviews

2016-12-30 Thread David Duncan

> On Dec 28, 2016, at 4:14 PM, Doug Hill  wrote:
> 
> Hi Ken,
> 
> I uploaded a sample project here:
> 
> https://github.com/djfitz/TestAutolayoutAnimations
> 
> I tried to strip this down to what is needed to show the behavior I see.
> 
> My code to actually do the animation is this:
> 
> - (IBAction)animateIt:(id)sender
> {
>   static BOOL small = NO;
> 
>   if( small )
>   {
>   [self.view layoutIfNeeded];
> 
>   self.containerWidthConstraint.constant = 
> self.view.frame.size.width;
> 
>   [UIView animateWithDuration:1 animations:
>   ^{
>   [self.view layoutIfNeeded];
>   }];
>   }
>   else
>   {
>   [self.view layoutIfNeeded];
> 
>   self.containerWidthConstraint.constant = 
> self.view.frame.size.width / 2;
> 
>   [UIView animateWithDuration:1 animations:
>   ^{
>   [self.view layoutIfNeeded];
>   }];
>   }
> 
>   small = !small;
> }
> 
> 'container view' has one subview which is a UILabel. The label is pinned to 
> the superview edges via autolayout constraints. (e.g. trailing, leading, top, 
> bottom edges all pinned to superview edges.)
> 
> I tried a few different variations, including leaving out the first 
> layoutIfNeeded (which some people say should be done, others not).
> 
> The exact behavior is that the label will resize to the new size immediately 
> and reflow the text, then the container view will animate it's size change. 
> It would be nice if both the label and the container view animate at the same 
> time.
> Also, as I mentioned, a button will exhibit the same behavior, probably 
> because it has a UILabel inside it to show the button text.

Labels (and other content provided via -drawRect:) will almost universally 
behave this way without additional work on your part, as the content is redrawn 
instantly at the final size. At best you might get an animation where the 
content resizes into place, but more often than not, it will pop in some 
undesirable way. Generally the only way to get good animations with drawn 
content is to snapshot in some way and execute an custom animation from the old 
to the new content (snapshotting isn’t necessarily literal here – it can just 
mean creating a new label with the new content as one example).

> 
> Thanks again for any ideas.
> 
> Doug Hill
> 
> 
>> On Dec 28, 2016, at 12:50 PM, Ken Thomases  wrote:
>> 
>> On Dec 28, 2016, at 1:55 PM, Doug Hill  wrote:
>>> 
>>> I can now animate my constraint changes but I notice that subviews aren't 
>>> animated. For example, I have a single view with a width constraint, and 
>>> this view has a label as a subview that expands to the size of it's parent 
>>> view via edge constraints.
>>> I can change the width constraint constant of the parent view at runtime 
>>> and it animates very well. However, the subviews jump into place 
>>> immediately then the parent view animates into place. I see the same 
>>> behavior with a button as a subview.
>> 
>> Show exactly how you're animating the constraint changes.  Are you really 
>> animating the change of the constraint or are you doing a layoutIfNeeded 
>> within an animation context?  Even if the former, are you calling any 
>> methods that force layout (layoutIfNeeded or similar)?  If so, where/when?
>> 
>> 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/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan


___

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: My app only shows a black screen in the recent apps list

2016-12-30 Thread David Duncan

> On Dec 27, 2016, at 3:52 AM, Andreas Falkenhahn  
> wrote:
> 
> On 25.12.2016 at 16:57 David Duncan wrote:
> 
>>> On Dec 23, 2016, at 9:05 AM, Andreas Falkenhahn  
>>> wrote:
> 
>>> Further examinations have shown that the issue might be related to the
>>> fact that my app has the "UIApplicationExitsOnSuspend" flag set to YES.
>>> When removing this flag, it seems to work correctly. When activating it
>>> again, however, iOS shows the image from the last run of the app with
>>> "UIApplicationExitsOnSuspend" set to NO. Really does smell like an iOS
>>> bug.
> 
>> This is actually probably the expected behavior in that case, and
>> all due to the fact that the app *exits* when you leave it.
> 
> I'm not sure. As I said, it also happens quite often that the image alternates
> when just browsing through the recent apps list. Sometimes the launch image is
> shown, sometimes a screenshot - but without me leaving the recent apps list!

This is rather the nature of undefined behavior though – when in the task 
switcher we try to update your image, but may suspend the application at some 
point. But since you aren’t necessarily in the background, we may not *kill* 
the application. The application being unable to respond in time for a snapshot 
is what may result in the snapshot behaving oddly, and a suspended application 
may not respond in a timely fashion.

> This is really weird behaviour. I close my app, wait 10 seconds so that it
> is really gone and then open the recent apps list and browse through it:
> Sometimes the launch image is shown for my app, sometimes a screenshot,
> in one and the same instance of the recent apps list, i.e. without exiting
> the recent apps list and reopening it again. That doesn't really make sense 
> to me…

Honestly, just remove UIApplicationExistsOnSuspend. Its simply not a behavior 
that is expected of modern iOS applications.
--
David Duncan


___

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: App with QuickLook Generator

2016-12-30 Thread Raglan T. Tiger
> On Dec 30, 2016, at 5:58 AM, Uli Kusterer  
> wrote:
> 
>  I guess Apple got around to sandboxing that process.


This statement seems confusing ... if Apple got around to:

Sandbox: QuickLookSatelli(985) deny file-read-data

why would this only apply to an older OS version, 10.9.5 but not apply to newer 
10.10.x and above versions?

I just sneed some clarification.


-rags
___

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: NSTouchBar in Carbon

2016-12-30 Thread Uli Kusterer
On 12 Dec 2016, at 07:22, David M. Cotter  wrote:
> My app is mostly C++ (because it’s cross platform) with Carbon on the UI 
> edges, and the absolute minimum required ObjectiveC++ to make it work.  
> (please no discussion about why this is stupid / i should write a modern app 
> etc)
> 
> So I need to programmatically instantiate an NSTouchBar, somehow
> 
> i do have a “MainController” which is just an NSObject, and a literally empty 
> nib i COULD put something into.
> 
> but i do NOT have an NSView or NSViewController to connect the touch bar to, 
> and i’d prefer not to have to use any storyboard if i can avoid it (of course 
> i will if it can’t be avoided)
> 
> how do i go about just creating an NSTouchBar in objC and having it show up 
> and respond to taps?

 From a casual look at the comments in the NSTouchBar.h header, it seems as if 
you only need an application delegate (which I assume you mean by your 
MainController NSObject?) that implements NSTouchBarProvider to return an 
NSTouchBar object. Of course, if you implement it all there, you'll have to 
come up with your own way to determine from the frontmost window etc. which 
items to show.

 As to implementing the actual items, it seems like, lacking an NSCarbonView, 
you need to use an NSView to provide those (and if you're using some standard 
view, that will in turn need to either be subclassed or need another object to 
talk to that knows how to dispatch messages to your Carbon code.

 FWIW, in our Cocoa port, we tried just funneling everything through the app 
delegate as fake Carbon events (and all our existing code needed minimal 
changes to handle fake instead of real events because the structure stayed the 
same). We eventually gave up on that as it just invites impedance mismatches 
about who gets what message. So in the end, we changed all our C++ classes to 
create Cocoa NSWindowController objects and load the actual windows from Cocoa 
(but still use our fake Carbon Events to dispatch stuff under the hood).

 That meant all windows converted worked as part of the responder chain. It's 
been too long for me to remember what we actually did in what order. I think we 
first converted the menu bar to Cocoa alone, then slowly migrated windows bit 
by bit, starting with modal windows first. Maybe that info helps you some in 
deciding what to do.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de


___

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: App with QuickLook Generator

2016-12-30 Thread Uli Kusterer
On 30 Dec 2016, at 00:28, Raglan T. Tiger  wrote:
> I have a QL Generator in y App Bundle ... been there since, we'll, a long 
> time.  The ql generator needs to read a file to get some instructions. The 
> sea always worked fine.
> 
> Now building with 10.11 SDK on XC 7.3.1the ql generator is denied reading the 
> instruction file on OS X version 10.9.5 with this message:
> 
> Sandbox: QuickLookSatelli(985) deny file-read-data / Users / x / 
> Documents / y / dict.plist 
> 
> This does not occur on 10.11.x or 10.12.1 and never occurred before building  
> as described above.
> 
> So, what am I missing re:Sandbox (even though the app is not sandboxed)

 QuickLook importers are plugins loaded into a QuickLook system process running 
in the background, not in your app. I guess Apple got around to sandboxing that 
process. I don't know if there is any documentation (haven't worked on a 
QuickLook importer in years), but I'd try properly adding sandboxing 
entitlements to your importer and seeing if that fixes things, as if it was a 
standalone app.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de


___

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