Date   

Re: Getting Started with Animations

Dave
 

Thanks a lot Jens. I’ll download it now and take a look.

All the Best
Dave

On 13 Jul 2017, at 15:13, Dave <dave@...> wrote:

Hi All,

I’m about to add some animations to my game and was wondering if any could give me some advice on the implementation given my App. This is for iOS Landscape only at present but I am intending on doing a Mac version too, so if it can be made as compatible as possible that would be good.

The App is a Board Game, there are two main views, the left had side is a Player Area and the right hand side is the Board. The View Hierarchy is something like this:

RootView
LeftAreaView
BoardView
CellView’s (81 in total - 9 x 9).
RightAreaView
BagView
ScrollView Containing the Host layer’s current Pieces
Scroll View Containing the Player has the current turn.

The way the game works is that Players pick pieces at Random from the Bag - the Actually “Picking” is done by the GameEngine and the View Controller gets sent a “Player X picked Piece Y” type message. When this occurs I want to Animate the piece Dropping from the “Bag” into the Players “Stash” (One of the Scroll Views). When a player makes a Move, the View Controller gets sent “Player X Moved Piece Y into Cell X” type message, in this case I want to animate the Piece being removed from the “Stash” and Placed on the board.

What is the best way to achieve this? Do I use CALayer?

All the Best
Dave




Re: Getting Started with Animations

 


On Jul 13, 2017, at 6:13 AM, Dave <dave@...> wrote:

What is the best way to achieve this? Do I use CALayer? 

Yup, I would recommend using CALayers for the whole UI, pretty much. Back when Core Animation first came out I wrote a framework for building board/card games:
It hasn’t been updated since 2011 so it probably needs some fixes for API changes, but I still think the basic design is pretty well thought out. The goal was that you could implement a simple game UI in <200 lines of code, and there are examples included for checkers, tic-tac-toe, Klondike solitaire, and a few others.

—Jens


Getting Started with Animations

Dave
 

Hi All,

I’m about to add some animations to my game and was wondering if any could give me some advice on the implementation given my App. This is for iOS Landscape only at present but I am intending on doing a Mac version too, so if it can be made as compatible as possible that would be good.

The App is a Board Game, there are two main views, the left had side is a Player Area and the right hand side is the Board. The View Hierarchy is something like this:

RootView
LeftAreaView
BoardView
CellView’s (81 in total - 9 x 9).
RightAreaView
BagView
ScrollView Containing the Host layer’s current Pieces
Scroll View Containing the Player has the current turn.

The way the game works is that Players pick pieces at Random from the Bag - the Actually “Picking” is done by the GameEngine and the View Controller gets sent a “Player X picked Piece Y” type message. When this occurs I want to Animate the piece Dropping from the “Bag” into the Players “Stash” (One of the Scroll Views). When a player makes a Move, the View Controller gets sent “Player X Moved Piece Y into Cell X” type message, in this case I want to animate the Piece being removed from the “Stash” and Placed on the board.

What is the best way to achieve this? Do I use CALayer?

All the Best
Dave


Re: UIDocumentInteractionController with non-standard file types

Steve Mills
 

On Jul 12, 2017, at 13:16:37, Steve Christensen <punster@...> wrote:

It is spitting out what it finds, not what it doesn't. And depending on what you were expecting, it could have reported the same behavior on a real device, depending on what apps are installed. Which is how it should be.

Sure, it can be inconvenient for debugging when you're not seeing expected results but that method isn't purposefully misleading.
Your opinion. Plenty of Apple software spit out log messages that are *far* less informative than a simple "No apps found - not displaying Open In" would be.

--
Steve Mills
Drummer, Mac geek


Re: UIDocumentInteractionController with non-standard file types

Steve Christensen
 

On Jul 12, 2017, at 10:56 AM, Steve Mills <sjmills@...> wrote:

On Jul 12, 2017, at 08:44:19, Steve Christensen <punster@...> wrote:

Have you tried it on a real device to see if there is any difference in behavior?
That was the problem. Too bad it doesn't at least spit out a log message that no apps could be found. That would've saved lots of confusion and debugging.
It is spitting out what it finds, not what it doesn't. And depending on what you were expecting, it could have reported the same behavior on a real device, depending on what apps are installed. Which is how it should be.

Sure, it can be inconvenient for debugging when you're not seeing expected results but that method isn't purposefully misleading.


Re: UIDocumentInteractionController with non-standard file types

Steve Mills
 

On Jul 12, 2017, at 08:44:19, Steve Christensen <punster@...> wrote:

Have you tried it on a real device to see if there is any difference in behavior?
That was the problem. Too bad it doesn't at least spit out a log message that no apps could be found. That would've saved lots of confusion and debugging.

--
Steve Mills
Drummer, Mac geek


Re: UIDocumentInteractionController with non-standard file types

Steve Christensen
 

On Jul 11, 2017, at 2:53 PM, Steve Mills <sjmills@...> wrote:

My iOS app has 2 custom UTIs declared in the Imported UTIs section, and 3 Document Types (those 2, plus pdf). When I try to share a file (doesn't matter if the URL's UTI is one of the custom types or pdf), it presentOpenInMenuFromBarButtonItem:animated: fails. If I use presentOptionsMenuFromBarButtonItem:buttonItem:animated:, it works.

This is all in the simulator, so there might not be any apps that Open In will work with. The files are in my app's Documents dir. I have the delegate set to my view controller, and I implemented ALL UIDocumentInteractionControllerDelegate the methods so I could log which ones get called. None get called when I use the OpenIn version. Here are the messages in the simulator's log when I use the OptionsMenu version. Could it be an entitlements problem?

Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: UIDocumentInteractionControllerDelegate implements legacy action methods. Please remove them.
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform print:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform copy:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform saveToCameraRoll:
Jul 11 16:49:53 MN5669AM007052 Box of Fun[69053]: will present options
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=69053
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:59 MN5669AM007052 Box of Fun[69053]: presented open in
Jul 11 16:50:06 MN5669AM007052 assertiond[33257]: assertion failed: 14F2411 13C75: assertiond + 13207 [792516D1-991E-36EE-8454-16F8220758D6]: 0x1

Sent from iCloud's ridiculous UI, so, sorry about the formatting


UIDocumentInteractionController with non-standard file types

Steve Mills
 

My iOS app has 2 custom UTIs declared in the Imported UTIs section, and 3 Document Types (those 2, plus pdf). When I try to share a file (doesn't matter if the URL's UTI is one of the custom types or pdf), it presentOpenInMenuFromBarButtonItem:animated: fails. If I use presentOptionsMenuFromBarButtonItem:buttonItem:animated:, it works.

This is all in the simulator, so there might not be any apps that Open In will work with. The files are in my app's Documents dir. I have the delegate set to my view controller, and I implemented ALL UIDocumentInteractionControllerDelegate the methods so I could log which ones get called. None get called when I use the OpenIn version. Here are the messages in the simulator's log when I use the OptionsMenu version. Could it be an entitlements problem?

Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: UIDocumentInteractionControllerDelegate implements legacy action methods. Please remove them.
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform print:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform copy:
Jul 11 16:49:52 MN5669AM007052 Box of Fun[69053]: can perform saveToCameraRoll:
Jul 11 16:49:53 MN5669AM007052 Box of Fun[69053]: will present options
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Jul 11 16:49:55 MN5669AM007052 pkd[33271]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=69053
Jul 11 16:49:55 MN5669AM007052 Box of Fun[69053]: SecTaskCopyDebugDescription: Box of Fun[69053]
Jul 11 16:49:59 MN5669AM007052 Box of Fun[69053]: presented open in
Jul 11 16:50:06 MN5669AM007052 assertiond[33257]: assertion failed: 14F2411 13C75: assertiond + 13207 [792516D1-991E-36EE-8454-16F8220758D6]: 0x1

Sent from iCloud's ridiculous UI, so, sorry about the formatting


Printing NSTextView puts text in middle of page - Solved

tridiak
 

Sorry for noise. Found the solution 5mins after I sent the email.

Mark


Re: NSInteger and NSUInteger

dhoerl
 

Xcode list 2013:

Date: Sun, 17 Nov 2013 15:38:22 -0500
From: Andy Lee <aglee@...>
To: "Gerriet M. Denkmann" <gerriet@...>
Cc: Xcode Users <xcode-users@...>
Subject: Re: printing NSUInteger in iOS
Message-ID: <E2CA2BAA-E03C-4850-8F42-7D3611A21C75@...>
Content-Type: text/plain; charset=us-ascii

I've been grudgingly casting, but there is this, which I haven't yet memorized:

<https://twitter.com/gparker/status/377910611453046784>
%zd, %tu, %tx (signed, unsigned, hex) currently format NSInteger and NSUInteger with no warnings.
--Andy


Re: NSInteger and NSUInteger

dhoerl
 

Original post of this solution came from no other than Greg Parker!


Printing NSTextView puts text in middle of page

tridiak
 

Printing a NSTextView centres the text (if it is less than one page in size) vertically in the page, as opposed to the top.
What do you need to do to fix this?

let tv = NSTextView()
tv.textStorage?.append(ats)


var npo = NSPrintOperation.init(view: tv);
tv.frame.size.width = (sampleViewScroll.documentView?.frame.size.width)!;
tv.frame.size.height = 20000; // or some large number
npo.run();

The attributed text (ats) is valid (displayed in a visible NSTextView).

Do I need to calculate the size of the text and set the margins?
Or is there a justification setting I am missing?

TIA
Mark


Re: NSInteger and NSUInteger

Steve Christensen
 

On Jul 10, 2017, at 6:13 AM, Steve Mills <sjmills@...> wrote:

On Jul 10, 2017, at 04:54:24, Gerriet M. Denkmann <g@...> wrote:

Formats for NS(U)Integer:
%t… (%td, %to, %tu %tx, %tX) for unsigned results NSUInteger
%z… (%zd, %zo, %zu %zx, %zX) for signed results NSInteger

Where did you find this info? I've seen mention of them, but never an official type doc that lists them.

General information on format specifiers is here:


I use %td for NSInteger and %tu for NSUInteger. The 't' is a length modifier specifying that a following d, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument. That allows you to use the same format specifier for both 32- and 64-bit platforms, get the correct results, and avoid compiler warnings.


Re: NSInteger and NSUInteger

Gerriet M. Denkmann
 

On 10 Jul 2017, at 20:36, Dave <dave@...> wrote:

Thanks a lot for this - where did you find it?
Probably this was posted on Apple’s CocoaDev mailing list by someone who surely knows about these things.

Gerriet.


Re: NSInteger and NSUInteger

Dave
 

Hi,

Thanks a lot for this - where did you find it?

Cheers
Dave

On 10 Jul 2017, at 11:54, Gerriet M. Denkmann <g@...> wrote:


On 10 Jul 2017, at 16:37, Dave <dave@...> wrote:

I’m trying to use NSInteger and/or NSUInteger in a InitWithFormat statement, I’m using %ld as the specifier but this is producing warnings? Has this changed recently, because code that used to compile without warnings now cause warnings. What is the correct specifier to use for these types?
Formats for NS(U)Integer:
%t… (%td, %to, %tu %tx, %tX) for unsigned results NSUInteger
%z… (%zd, %zo, %zu %zx, %zX) for signed results NSInteger

Gerriet.




Re: NSInteger and NSUInteger

Steve Mills
 

On Jul 10, 2017, at 04:54:24, Gerriet M. Denkmann <g@...> wrote:


Formats for NS(U)Integer:
%t… (%td, %to, %tu %tx, %tX) for unsigned results NSUInteger
%z… (%zd, %zo, %zu %zx, %zX) for signed results NSInteger
Where did you find this info? I've seen mention of them, but never an official type doc that lists them.

--
Steve Mills
Drummer, Mac geek


Re: NSInteger and NSUInteger

Gerriet M. Denkmann
 

On 10 Jul 2017, at 16:37, Dave <dave@...> wrote:

I’m trying to use NSInteger and/or NSUInteger in a InitWithFormat statement, I’m using %ld as the specifier but this is producing warnings? Has this changed recently, because code that used to compile without warnings now cause warnings. What is the correct specifier to use for these types?
Formats for NS(U)Integer:
%t… (%td, %to, %tu %tx, %tX) for unsigned results NSUInteger
%z… (%zd, %zo, %zu %zx, %zX) for signed results NSInteger

Gerriet.


NSInteger and NSUInteger

Dave
 

Hi,

I’m trying to use NSInteger and/or NSUInteger in a InitWithFormat statement, I’m using %ld as the specifier but this is producing warnings? Has this changed recently, because code that used to compile without warnings now cause warnings. What is the correct specifier to use for these types?

Thanks a lot
All the Best
Dave


Re: BundleDisplayName

Quincey Morris
 

On Jul 9, 2017, at 21:15 , Gerriet M. Denkmann <g@...> wrote:

But I don’t like the asymmetry of it:
Change the Finder name for development region: change PRODUCT_NAME in Build Settings

My guess is that it asymmetric for historical and/or compatibility reasons. There’s also something about the Finder storing a “.Localized…” named file inside the bundle, but I don’t know if that’s still a current thing.

But at least you have a way forward that’s set-and-forget?


Re: BundleDisplayName

Gerriet M. Denkmann
 

On 10 Jul 2017, at 01:13, Quincey Morris <quinceymorris@...> wrote:

On Jul 9, 2017, at 07:45 , Gerriet M. Denkmann <g@...> wrote:

It never reads Base.lproj, even if the system language = Localization native development region = CFBundleDevelopmentRegion

The problem is that Xcode (obviously unaware of this Finder peculiarity) does NOT allow English as an additional localisation (because the development region already is English; so English speaking computers should just use Base.lproj).

What can be done?
I’m not sure I understand completely, but I think you’re missing one point.

As with the base localization, which (as you say) means that Xcode treats it as the “localization” for the development language, and you omit the actual localization for that language (English in your example), the Finder AFAIK uses the “unlocalized” bundle file name as the “base” file name. (Because it’s a bundle, it’s actually a directory name, but the principle is the same.)

If you the developer are on an English system, you can change the “base” file name any time you want, after the app bundle is created, by renaming it in the Finder. I do this all the time for my apps, and the final “base” name is nowhere in my Xcode project settings. Again AFAIK, this has *no* downstream consequences for localized non-English systems — as you’ve seen, the original name is irrelevant when the Finder actually applies localization to the name.

If you want to create the app with the desired English name during archiving, rather than renaming it later, then you must change build settings. AFAIK the one that controls the bundle’s file name is “Product Name”. The default value of this setting is “$(TARGET_NAME)”. If you don’t want the target name, you can put anything you want in there, minus the extension.

So, I assume that if you put the desired English name of your app in the Product Name setting, you’ll get the results you want in all localizations.
Here the result of my investigations so far:

1. The file-system-name (shown by ls command) = PRODUCT_NAME.
The PRODUCT_NAME is initially set to $(TARGET_NAME).
Changing the Target Name to: “New name” changes the Build settings to: PRODUCT_NAME = “New name”.

2. The app-menu and the About Panel show “Bundle name".

3. The Finder shows “Bundle display name" but only if:
3a. Info.plist contains Bundle display name = $(PRODUCT_NAME)
3b. <current language>.lproj exists, contains InfoPlist.strings and this has CFBundleDisplayName
The Finder does NOT fall back to Base.lproj for current language = development region (as everybody else does).

I fixed my problem by creating a copy of Bundle.lproj/InfoPlist.strings, putting it into an en.lproj folder and adding this in Xcode to the resources of my app.

Sure I could also (as you mentioned) change the PRODUCT_NAME (which has the additional advantage of file-system-name = Finder-name).
But I don’t like the asymmetry of it:
Change the Finder name for development region: change PRODUCT_NAME in Build Settings
Change the Finder name for any other language: change CFBundleDisplayName in xx.lproj/InfoPlist.strings

On the other hand, if the Finder name is the same for all languages, then using the PRODUCT_NAME is clearly better.

Thanks for your help!

One more thing:
Main.strings contains:
/* Class = "NSMenuItem"; title = "AppName"; ObjectID = "1Xt-HY-uBw"; */
"1Xt-HY-uBw.title" = "AppName";

/* Class = "NSMenuItem"; title = "Quit AppName"; ObjectID = "4sb-4s-VLi"; */
“4sb-4s-VLi.title” = “Quit AppName";

I tried to change this to:
"1Xt-HY-uBw.title" = "$(PRODUCT_NAME)";
“4sb-4s-VLi.title” = "Quit $(PRODUCT_NAME)";

But of course the last line does not work.
Could this work?
There are quite a few place where the AppName is hardcoded: About, Quit, Help (maybe more).


Kind regards,

Gerriet.

1401 - 1420 of 1460