Re: Connecting NSTextStorage to a string

2016-12-23 Thread Keary Suska

> On Dec 23, 2016, at 8:16 PM, Daryle Walker  wrote:
> 
> The text controls on macOS use a NSTextStorage object to retain their text. 
> That object is a extension of an attributed string. Let's say you use a 
> NSString (or similar) in your document model. How should I get changes on one 
> string to get mirrored on the other?
> 
> I think there are begin/end-editing flag methods on text controls, but how 
> would I go the other way?

In my experience, real-time synchronization of vanilla NSString to an 
NSTextStorage of an NSTextView is painful and fraught with error. Much easier 
to simply set the content of the NSTextView on load (in windowDidLoad or 
whatever is apropos for your setup), and then let the NSTextView manage the 
content until editing has been committed, at which time you pull the plain 
string out and set your model property.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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


Connecting NSTextStorage to a string

2016-12-23 Thread Daryle Walker
The text controls on macOS use a NSTextStorage object to retain their text. 
That object is a extension of an attributed string. Let's say you use a 
NSString (or similar) in your document model. How should I get changes on one 
string to get mirrored on the other?

I think there are begin/end-editing flag methods on text controls, but how 
would I go the other way?

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


Custom NSCollectionViewLayout isn't causing scrollbars to appear

2016-12-23 Thread Steve Mills
I'm using a custom layout subclass because I want a specific number of columns 
at a specific size, which should cause the scroll view's horizontal scrollbar 
to appear, but it's not. What do I have to do to make it appear? The checkbox 
for both scrollbars is turned on in IB.

--
Steve Mills
Drummer, Mac geek


___

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-23 Thread Andreas Falkenhahn
On 23.12.2016 at 15:01 Alex Zavatone wrote:

> Andreas, I've seen very interesting behaviour on iOS it you have
> not supplied a launch image or if you have not supplied one that has
> the screen dimensions that your device needs natively.  It appears
> to fall back to check if a launch image of a smaller size is
> available and then the resolution takes the size of that other image
> and scales up to be full screen while preserving the aspect ratio of the 
> image.

> So, the dimensions of your launch image are directly related to the
> the screen size of your app.  I could see how not having a launch
> image would cause a black screen shot.

> What version of iOS and which device are you running this on? 

Latest iOS on iPad Air 2.

> What happens in the simulator?

I haven't tried the simulator because it's painfully slow here
(I'm on a 2012 Mac Mini).

-- 
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-23 Thread Andreas Falkenhahn
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.

On 23.12.2016 at 14:35 Andreas Falkenhahn wrote:

> On 22.12.2016 at 21:58 David Duncan wrote:

>> Do you do anything special when going into the background? The
>> snapshot is taken shortly after your application is placed in the
>> background, so if your view hierarchy changes that is what will actually be 
>> snapshotted.

> No, I'm actually not doing anything when the app is shutdown. All
> respective delegate methods are completely empty. I should add
> that the actual drawing is done by a worker thread, but of course
> this thread calls dispatch_sync() when exchanging the layer's
> contents to the new image, e.g.

>  dispatch_sync(dispatch_get_main_queue(), ^{
>  myView.layer.contents = (id) myImage;
>  });

> So it could probably happen that this code is executed even after
> iOS runs methods like applicationWillResignActive() but certainly
> not at the same time because I use dispatch_sync() to change the
> layer's contents on the main thread.

> Upon closer observation, the behaviour is actually really strange.
> Now that I've added launch images (not a storyboard) the black screen
> is gone but the launch image is shown instead. But not always!
> Sometimes there's also a snapshot of my app. And what makes the
> confusion complete is the fact that iOS sometimes even alternates (!)
> between those two images when cycling through the recent apps list,
> e.g. when cycling through the recent apps list by swiping to the left
> my app shows the launch image. Then, without leaving the recent
> apps list, I'm cycling through the list again, but this time by swiping
> to the right, and suddenly my app shows the correct snapshot from
> the last frame it drew! This is really confusing. Smells like an
> iOS bug to me because why would it alternate between the launch image
> and a snapshot without me ever leaving the recent apps list? 



-- 
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-23 Thread Alex Zavatone
Andreas, I've seen very interesting behaviour on iOS it you have not supplied a 
launch image or if you have not supplied one that has the screen dimensions 
that your device needs natively.  It appears to fall back to check if a launch 
image of a smaller size is available and then the resolution takes the size of 
that other image and scales up to be full screen while preserving the aspect 
ratio of the image.  

So, the dimensions of your launch image are directly related to the the screen 
size of your app.  I could see how not having a launch image would cause a 
black screen shot.

What version of iOS and which device are you running this on?  What happens in 
the simulator?

On Dec 23, 2016, at 7:35 AM, Andreas Falkenhahn wrote:

> On 22.12.2016 at 21:58 David Duncan wrote:
> 
>> Do you do anything special when going into the background? The
>> snapshot is taken shortly after your application is placed in the
>> background, so if your view hierarchy changes that is what will actually be 
>> snapshotted.
> 
> No, I'm actually not doing anything when the app is shutdown. All
> respective delegate methods are completely empty. I should add
> that the actual drawing is done by a worker thread, but of course
> this thread calls dispatch_sync() when exchanging the layer's
> contents to the new image, e.g.
> 
> dispatch_sync(dispatch_get_main_queue(), ^{
> myView.layer.contents = (id) myImage;
> });
> 
> So it could probably happen that this code is executed even after
> iOS runs methods like applicationWillResignActive() but certainly
> not at the same time because I use dispatch_sync() to change the
> layer's contents on the main thread.
> 
> Upon closer observation, the behaviour is actually really strange.
> Now that I've added launch images (not a storyboard) the black screen
> is gone but the launch image is shown instead. But not always!
> Sometimes there's also a snapshot of my app. And what makes the
> confusion complete is the fact that iOS sometimes even alternates (!)
> between those two images when cycling through the recent apps list,
> e.g. when cycling through the recent apps list by swiping to the left
> my app shows the launch image. Then, without leaving the recent
> apps list, I'm cycling through the list again, but this time by swiping
> to the right, and suddenly my app shows the correct snapshot from
> the last frame it drew! This is really confusing. Smells like an
> iOS bug to me because why would it alternate between the launch image
> and a snapshot without me ever leaving the recent apps list? 
> 
> -- 
> 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/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


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

2016-12-23 Thread Andreas Falkenhahn
On 22.12.2016 at 21:58 David Duncan wrote:

> Do you do anything special when going into the background? The
> snapshot is taken shortly after your application is placed in the
> background, so if your view hierarchy changes that is what will actually be 
> snapshotted.

No, I'm actually not doing anything when the app is shutdown. All
respective delegate methods are completely empty. I should add
that the actual drawing is done by a worker thread, but of course
this thread calls dispatch_sync() when exchanging the layer's
contents to the new image, e.g.

 dispatch_sync(dispatch_get_main_queue(), ^{
 myView.layer.contents = (id) myImage;
 });

So it could probably happen that this code is executed even after
iOS runs methods like applicationWillResignActive() but certainly
not at the same time because I use dispatch_sync() to change the
layer's contents on the main thread.

Upon closer observation, the behaviour is actually really strange.
Now that I've added launch images (not a storyboard) the black screen
is gone but the launch image is shown instead. But not always!
Sometimes there's also a snapshot of my app. And what makes the
confusion complete is the fact that iOS sometimes even alternates (!)
between those two images when cycling through the recent apps list,
e.g. when cycling through the recent apps list by swiping to the left
my app shows the launch image. Then, without leaving the recent
apps list, I'm cycling through the list again, but this time by swiping
to the right, and suddenly my app shows the correct snapshot from
the last frame it drew! This is really confusing. Smells like an
iOS bug to me because why would it alternate between the launch image
and a snapshot without me ever leaving the recent apps list? 

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