Date   

Re: iOS: TableView inside ScrollView

Steve Mills
 

On Sep 18, 2018, at 03:47:36, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

iOS 11, Xcode 10

I have a view with an UIScrollView, which is bound on all 4 sides to the save area.

This ScrollView contains:
UILabel
UITableView
UILabel

The problem: if the TableView does *not* have a definite height, then Xcode complains: “The ScrollView needs y-position or height fixed”.

But the whole point of the TableView is that the number of rows can change at run time.

The effect I want is similar to Settings → Wi-Fi where unter “Choose a Network” there is a dynamically changing list of names.
And the whole page can be scrolled vertically.
That's simply a table view with static sections, and each section has a set number of rows. The Choose a Network section has variable number of rows, added programmatically. You don't need to add these things to a scroll view - the table view takes care of that.

--
Steve Mills
Drummer, Mac geek


XPC Question

Sandor Szatmari
 

Can you do XPC RPC over an IP connection? Or, in other words… Can you do XPC between two computers?

Thanks,
Sandor


iOS: TableView inside ScrollView

Gerriet M. Denkmann
 

iOS 11, Xcode 10

I have a view with an UIScrollView, which is bound on all 4 sides to the save area.

This ScrollView contains:
UILabel
UITableView
UILabel

The problem: if the TableView does *not* have a definite height, then Xcode complains: “The ScrollView needs y-position or height fixed”.

But the whole point of the TableView is that the number of rows can change at run time.

The effect I want is similar to Settings → Wi-Fi where unter “Choose a Network” there is a dynamically changing list of names.
And the whole page can be scrolled vertically.

How to achieve this?

Gerriet.


Re: Window Position and Size Restored

Dave
 

Got it thanks, I knew there was a property for it somewhere, but was looking in the wrong pane.

On 17 Sep 2018, at 17:07, Jon Gotow <gotow@stclairsoft.com> wrote:

See NSWindow.frameAutosaveName. That should take care of it for you.

- Jon


On Sep 17, 2018, at 8:56 AM, Dave <dave@looktowindward.com> wrote:

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.



Re: Window Position and Size Restored

Andy Lee
 

Try unchecking the "Restorable" checkbox in IB.  I don't know why you aren't able to manually "override" this.


--Andy

On Sep 17, 2018, at 10:56 AM, Dave <dave@...> wrote:

Hi,

Mac, Manual Layout.

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.

-(void) awakeFromNib
{
[super awakeFromNib];

[self setFrame:NSMakeRect(0,0,256,256) display:YES];
}

Any suggestions or help greatly appreciated.

All the Best
Dave






Re: Window Position and Size Restored

Jon Gotow
 

See NSWindow.frameAutosaveName. That should take care of it for you.

- Jon

On Sep 17, 2018, at 8:56 AM, Dave <dave@looktowindward.com> wrote:

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.


Re: Maintaining Aspect Ration of a Window

Dave
 

Thanks a lot, I think this should do the trick!

On 17 Sep 2018, at 15:03, Sandor Szatmari <admin.szatmari.net@...> wrote:

Try -aspectRatio


Does that do what you want?

Sandor

On Sep 17, 2018, at 08:55, Dave <dave@...> wrote:

Thanks a lot, I was looking for the wrong method!

On 17 Sep 2018, at 14:23, Andy Lee via Groups.Io <aglee@...> wrote:

Yes, there is a window delegate method.  Given a proposed window size, you return the actual window size you would like to constrain to.


--Andy


On Mon, Sep 17, 2018, at 7:32 AM, Dave wrote:
> Mac, Manual Layout of Views.
>
> Hi All,
>
> Is there anyway to ensure that when a window resizes on the Mac it
> maintains its aspect ratio? I’m doing manual layout as for this project
> Auto Layout isn’t viable, so I guess I am really asking, is there anyway
> of stopping the Window resizing in response to the user dragging one of
> the edges?
>
> Thanks in advance.
>
> All the Best
> Dave
>
>
> 
>




Window Position and Size Restored

Dave
 

Hi,

Mac, Manual Layout.

I’m trying to reset the Window Position Size each time my App is run. When I run it under Debug, the Window Position keeps getting restored (AFAICT), I’ve subclassed NSWindow awakeFromNib and have tried resetting the Window FrameRect, but it doesn’t seem to have any affect. I’ve checked and it is getting called ok. I’ve tried setting the Frame before super awakeFromNib is called, but no effect.

-(void) awakeFromNib
{
[super awakeFromNib];

[self setFrame:NSMakeRect(0,0,256,256) display:YES];
}

Any suggestions or help greatly appreciated.

All the Best
Dave


Manual Layout on Mac

Dave
 

Hi,

I’m using Manual Layout on the Mac and I’ve also “isFippied" = YES on all views.

In Interface Builder, I have the following Window View Layout:

Window.view is set to LTWTestWindowView.

LTWTestWindowView
LTWTestViewBase
LTWTestViewBoard
LTWTestViewCuster
LTWTestViewCell

These are Custom Views and all have isFlipped = YES and all define the layout method.

When I first run the App, layout gets called on all views, but if I subsequently resize the window then it only calls layout on LTWTestWindowView. Is this expected behaviour? Do I need to call “layout” (or another method like layoutView which I define myself) on all the sub-views inside LTWTestWindowView?

Also, should layout called “super layout” ?

Thanks a lot for any help.
All the Best
Dave


Re: Maintaining Aspect Ration of a Window

Sandor Szatmari
 

On Sep 17, 2018, at 08:55, Dave <dave@...> wrote:

Thanks a lot, I was looking for the wrong method!

On 17 Sep 2018, at 14:23, Andy Lee via Groups.Io <aglee@...> wrote:

Yes, there is a window delegate method.  Given a proposed window size, you return the actual window size you would like to constrain to.


--Andy


On Mon, Sep 17, 2018, at 7:32 AM, Dave wrote:
> Mac, Manual Layout of Views.
>
> Hi All,
>
> Is there anyway to ensure that when a window resizes on the Mac it
> maintains its aspect ratio? I’m doing manual layout as for this project
> Auto Layout isn’t viable, so I guess I am really asking, is there anyway
> of stopping the Window resizing in response to the user dragging one of
> the edges?
>
> Thanks in advance.
>
> All the Best
> Dave
>
>
> 
>



Re: Maintaining Aspect Ration of a Window

Dave
 

Thanks a lot, I was looking for the wrong method!

On 17 Sep 2018, at 14:23, Andy Lee via Groups.Io <aglee@...> wrote:

Yes, there is a window delegate method.  Given a proposed window size, you return the actual window size you would like to constrain to.


--Andy


On Mon, Sep 17, 2018, at 7:32 AM, Dave wrote:
> Mac, Manual Layout of Views.
>
> Hi All,
>
> Is there anyway to ensure that when a window resizes on the Mac it
> maintains its aspect ratio? I’m doing manual layout as for this project
> Auto Layout isn’t viable, so I guess I am really asking, is there anyway
> of stopping the Window resizing in response to the user dragging one of
> the edges?
>
> Thanks in advance.
>
> All the Best
> Dave
>
>
> 
>



Re: Maintaining Aspect Ration of a Window

Andy Lee
 

Yes, there is a window delegate method.  Given a proposed window size, you return the actual window size you would like to constrain to.


--Andy


On Mon, Sep 17, 2018, at 7:32 AM, Dave wrote:
> Mac, Manual Layout of Views.
>
> Hi All,
>
> Is there anyway to ensure that when a window resizes on the Mac it
> maintains its aspect ratio? I’m doing manual layout as for this project
> Auto Layout isn’t viable, so I guess I am really asking, is there anyway
> of stopping the Window resizing in response to the user dragging one of
> the edges?
>
> Thanks in advance.
>
> All the Best
> Dave
>
>
>
>


Maintaining Aspect Ration of a Window

Dave
 

Mac, Manual Layout of Views.

Hi All,

Is there anyway to ensure that when a window resizes on the Mac it maintains its aspect ratio? I’m doing manual layout as for this project Auto Layout isn’t viable, so I guess I am really asking, is there anyway of stopping the Window resizing in response to the user dragging one of the edges?

Thanks in advance.

All the Best
Dave


Re: Document types not working

Steve Mills
 

On Sep 10, 2018, at 23:05:21, Steve Mills via Groups.Io <sjmills=mac.com@groups.io> wrote:

I'm sure I had this working earlier in development of the macOS version of my app, but custom file types are no longer openable by my app. I've declared exported UTIs for cbr and cbz extensions and added them as document types where each type has a Role of Viewer and a Handler rank of Owner.

There are at least 2 other apps on my machine that also claims both extensions. Files of either type are showing as being owned by one of them, even though I've told the system to open all files of that type with my app, so it's the default app for those types.

Note that there's also an iOS version of this app which uses a different bundle ID. It also claims these 2 types using its own app-specific UTIs. So builds of both apps exist on my Mac. Hopefully iOS app builds can not affect how macOS sees and registers file types.

This is spitting out nil:

[NSDocumentController.sharedDocumentController documentClassForType:@"Comic Book RAR"];

Here's one of the exported UTIs:

<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>Comic Book RAR</string>
<key>UTTypeIdentifier</key>
<string>com.ArmpitStudios.BoxOfFun.cbr</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>cbr</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-cbr</string>
</array>
</dict>
</dict>

And here's the corresponding document type:

<dict>
<key>CFBundleTypeIconFile</key>
<array/>
<key>CFBundleTypeName</key>
<string>Comic Book RAR</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.ArmpitStudios.BoxOfFun.cbr</string>
</array>
<key>NSDocumentClass</key>
<string>Document</string>
</dict>
Turns out that the OS is getting confused because there is another app that declares UTIs for files with the extensions my app can open. I've tried moving the UTIs from exported to imported, since my app does not create files of those types, it's only a viewer. I tried deleting the UTIs and leaving only the document types, which made my app unable to open the files from Open dialog or Finder. Deleting the LSItemContentTypes from each document type allows my app to *know* it can open the files again, but I then need to find another way to identify file types, since before I was using the UTI of the file.

How is this supposed to work for extensions that are widely used but aren't official like cbr and cbz?

--
Steve Mills
Drummer, Mac geek


Document types not working

Steve Mills
 

I'm sure I had this working earlier in development of the macOS version of my app, but custom file types are no longer openable by my app. I've declared exported UTIs for cbr and cbz extensions and added them as document types where each type has a Role of Viewer and a Handler rank of Owner.

There are at least 2 other apps on my machine that also claims both extensions. Files of either type are showing as being owned by one of them, even though I've told the system to open all files of that type with my app, so it's the default app for those types.

Note that there's also an iOS version of this app which uses a different bundle ID. It also claims these 2 types using its own app-specific UTIs. So builds of both apps exist on my Mac. Hopefully iOS app builds can not affect how macOS sees and registers file types.

This is spitting out nil:

[NSDocumentController.sharedDocumentController documentClassForType:@"Comic Book RAR"];

Here's one of the exported UTIs:

<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>Comic Book RAR</string>
<key>UTTypeIdentifier</key>
<string>com.ArmpitStudios.BoxOfFun.cbr</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>cbr</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-cbr</string>
</array>
</dict>
</dict>

And here's the corresponding document type:

<dict>
<key>CFBundleTypeIconFile</key>
<array/>
<key>CFBundleTypeName</key>
<string>Comic Book RAR</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.ArmpitStudios.BoxOfFun.cbr</string>
</array>
<key>NSDocumentClass</key>
<string>Document</string>
</dict>

Any ideas? This is driving me batty.

--
Steve Mills
Drummer, Mac geek


Re: Show splash screen before finished launching?

James Walker
 

On Sep 6, 2018, at 5:13 PM, Quincey Morris <quinceymorris@rivergatesoftware.com> wrote:

On Sep 6, 2018, at 11:17 , James Walker <list2@jwwalker.com> wrote:

I’m trying to show a splash screen in applicationWillFInishLaunching:, but it doesn’t actually appear until applicationDidFinishLaunching: seconds later.
Coming at this from the other side, why does it take enough seconds to get from willFinishLaunching to didFinishLaunching that you care? If you can reduce that time a bit, maybe you don’t have to solve the original problem.

IIRC from the last time this topic was discussed, getting windows displayed earlier than didFinishLaunching is pretty treacherous.
I come here looking for a simple solution, and you try to make me THINK? That’s hardly fair. :-)

I managed to move some work onto a different thread, and fix a place where my main thread was getting blocked for a while. Though it would still be nice to solve this mystery.

New clue: if I run the app in Xcode using the option "Launch application without state restoration", then the splash window appears sooner.


Re: Show splash screen before finished launching?

Quincey Morris
 

On Sep 6, 2018, at 11:17 , James Walker <list2@...> wrote:

I’m trying to show a splash screen in applicationWillFInishLaunching:, but it doesn’t actually appear until applicationDidFinishLaunching: seconds later.

Coming at this from the other side, why does it take enough seconds to get from willFinishLaunching to didFinishLaunching that you care? If you can reduce that time a bit, maybe you don’t have to solve the original problem.

IIRC from the last time this topic was discussed, getting windows displayed earlier than didFinishLaunching is pretty treacherous.



Re: Show splash screen before finished launching?

James Walker
 

On Sep 6, 2018, at 2:03 PM, Jon Gotow <gotow@stclairsoft.com> wrote:

Hmph - now that you mention it, there's no current runloop at that point - the app is still launching. So [NSRunloop currentRunLoop] is probably returning nil. You could grabbing mainRunLoop and running that, but I don't know what impact that's going to have during the app launch process.

- Jon
I wondered about that myself, and logged out the values of [NSRunloop currentRunLoop] and [NSRunloop mainRunLoop]. They showed the same non-nil value.


Re: Show splash screen before finished launching?

Jon Gotow
 

Hmph - now that you mention it, there's no current runloop at that point - the app is still launching. So [NSRunloop currentRunLoop] is probably returning nil. You could grabbing mainRunLoop and running that, but I don't know what impact that's going to have during the app launch process.

- Jon

On Sep 6, 2018, at 2:59 PM, James Walker <list2@jwwalker.com> wrote:

Tried that, no change.


Re: Show splash screen before finished launching?

James Walker
 

On Sep 6, 2018, at 1:39 PM, Jon Gotow <gotow@stclairsoft.com> wrote:

Try putting this after your orderFront call:

[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];

The runloop basically has to do at least one iteration before the new window will actually be mapped to the screen.

Tried that, no change.


- Jon


On Sep 6, 2018, at 12:17 PM, James Walker <list2@jwwalker.com> wrote:

I’m trying to show a splash screen in applicationWillFInishLaunching:, but it doesn’t actually appear until applicationDidFinishLaunching: seconds later. I’ve done all I can think of to make it show up:

[NSApp activateIgnoringOtherApps: YES];
[splashWindow orderFrontRegardless];
[splashWindow display];

Is there anything else I can do to make the window draw?

721 - 740 of 1422