Date   

Re: Can NSView and NSImageView respond to Mouse Clicks?

Keary Suska
 

NSView doesn’t have action handling—you get that from NSControl. If you need action handling, you might need an NSControl subclass rather than an NSView subclass. That being said, you can call your action method “manually” in an event handler for NSView.

As for NSImageView, It doesn’t look like you can specify action handling in Xcode. Have you tried calling -sendActionOn: on your image view?

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

On Sep 19, 2018, at 12:34 PM, Dave <dave@...> wrote:

Hi,

Can an Custom NSView respond to Mouse Clicks via IBActions?

Can the same be done with NSImageView? I’ve added an image view and connected it to an IBAction method define in my View Controller, but when I click the NSImageView nothing happens…..

Any help greatly appreciated.


Re: Adjusting Font Size to fit View Rectangle

Sandor Szatmari
 

Multiline, or single line?

Sandor

On Sep 19, 2018, at 14:29, Dave <dave@...> wrote:

Hi All,

Is there a Cocoa method I can use that will return the best fitting Font Size for a given String and Font?

I seem to remember using a method that does it but can’t seem to find it any more…..

All the Best
Dave




Can NSView and NSImageView respond to Mouse Clicks?

Dave
 

Hi,

Can an Custom NSView respond to Mouse Clicks via IBActions?

Can the same be done with NSImageView? I’ve added an image view and connected it to an IBAction method define in my View Controller, but when I click the NSImageView nothing happens…..

Any help greatly appreciated.

All the Best
Dave


Adjusting Font Size to fit View Rectangle

Dave
 

Hi All,

Is there a Cocoa method I can use that will return the best fitting Font Size for a given String and Font?

I seem to remember using a method that does it but can’t seem to find it any more…..

All the Best
Dave


Re: Segue

Gerriet M. Denkmann
 

On 19 Sep 2018, at 20:35, Steve Mills via Groups.Io <sjmills@...> wrote:

On Sep 19, 2018, at 05:14:11, Gerriet M. Denkmann <g@...> wrote:

I have an UITableViewController and the UITableViewCells have a Detail Accessory with an accessory action = Navigation Controller Show Detail

The UITableViewController does prepareForSegue.

The Storyboard Segue is of Kind Show Detail (e.g. Replace) and it Animates.

But: the Detail View slides in from *below* (expect: from right); sliding the Detail View from left to right does *not* get back to the UITableViewController and on top there is no “< Master” button which does the same.
Perhaps you just need to provide a custom transition animation. See this guide:

https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/CustomizingtheTransitionAnimations.html
The Xcode template Master-Detail App does it without custom transition animation.

It uses: Master : UITableViewController → UINavigationController → Detail : UIViewController

Detail slides in from right, and the user can remove the topmost view controller using the back button in the navigation bar or using a left-edge swipe gesture.


The only way I got it to work:
Master : UITableViewController → Detail : UIViewController
Storyboard Segue Kind = Show (e.g. Push)

Transition Style and Presentation of Master seems to have no effect.

Gerriet.


Re: Segue

Alex Zavatone
 

Change the Kind of the segue.  You’re going to want it set to Show (e.g. Push).

Also check below in the right panel and see which Presentation and which Transition you use.

On Sep 19, 2018, at 5:14 AM, Gerriet M. Denkmann <g@...> wrote:

iOS 11, Xcode 10

I have an UITableViewController and the UITableViewCells have a Detail Accessory with an accessory action = Navigation Controller Show Detail

The UITableViewController does prepareForSegue.

The Storyboard Segue is of Kind Show Detail (e.g. Replace) and it Animates.

But: the Detail View slides in from *below* (expect: from right); sliding the Detail View from left to right does *not* get back to the UITableViewController and on top there is no “< Master” button which does the same.

I tried to copy the Master-Detail App (supplied by Xcode) as closely as possible.
Everything looks the same, but it behaves differently.
What am I doing wrong?

Gerriet.






Re: Segue

Steve Mills
 

On Sep 19, 2018, at 05:14:11, Gerriet M. Denkmann <g@...> wrote:

I have an UITableViewController and the UITableViewCells have a Detail Accessory with an accessory action = Navigation Controller Show Detail

The UITableViewController does prepareForSegue.

The Storyboard Segue is of Kind Show Detail (e.g. Replace) and it Animates.

But: the Detail View slides in from *below* (expect: from right); sliding the Detail View from left to right does *not* get back to the UITableViewController and on top there is no “< Master” button which does the same.
Perhaps you just need to provide a custom transition animation. See this guide:

https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/CustomizingtheTransitionAnimations.html

--
Steve Mills
Drummer, Mac geek


Segue

Gerriet M. Denkmann
 

iOS 11, Xcode 10

I have an UITableViewController and the UITableViewCells have a Detail Accessory with an accessory action = Navigation Controller Show Detail

The UITableViewController does prepareForSegue.

The Storyboard Segue is of Kind Show Detail (e.g. Replace) and it Animates.

But: the Detail View slides in from *below* (expect: from right); sliding the Detail View from left to right does *not* get back to the UITableViewController and on top there is no “< Master” button which does the same.

I tried to copy the Master-Detail App (supplied by Xcode) as closely as possible.
Everything looks the same, but it behaves differently.
What am I doing wrong?

Gerriet.


Re: iOS: TableView inside ScrollView

Gerriet M. Denkmann
 

On 19 Sep 2018, at 07:16, Quincey Morris <quinceymorris@...> wrote:

On Sep 18, 2018, at 01:47 , Gerriet M. Denkmann <g@...> wrote:

The problem: if the TableView does *not* have a definite height, then Xcode complains: “The ScrollView needs y-position or height fixed”.
Keep in mind that UITableView is a kind of UIScrollView, which isn’t how NSTableView works. Your intended solution nests a scroll view within a scroll view, which is kind of hard to know how to lay out satisfactorily.

Steve’s suggestion of a table view with 3 sections is a good solution.
Yes. It certainly looks better than my current work-around:

NSLayoutConstraint *heightConstraint = self.tableView.constraints.firstObject;
heightConstraint.constant = nbr of rows in table * row height;

The documentation says: “See the Settings application for examples of grouped tables.”

So I am going to implement this.

Thanks a lot.


Kind regards,

Gerriet.


Re: iOS: TableView inside ScrollView

Quincey Morris
 

On Sep 18, 2018, at 01:47 , Gerriet M. Denkmann <g@...> wrote:

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

Keep in mind that UITableView is a kind of UIScrollView, which isn’t how NSTableView works. Your intended solution nests a scroll view within a scroll view, which is kind of hard to know how to lay out satisfactorily.

Steve’s suggestion of a table view with 3 sections is a good solution.


Re: XPC Question

Sandor Szatmari
 

On Sep 18, 2018, at 12:46, Jens Alfke <jens@...> wrote:



On Sep 18, 2018, at 4:00 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

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

Jens, thanks for your input.
Not as far as I know.

In general, it’s a bad idea to use this sort of “hidden” RPC across a network. Networking is fundamentally unlike local function calls, and making a network call look exactly like a method call hides those differences and makes it easy to run into problems handling failures, dealing with protocol changes, enforcing security, and more.

Unfortunately Apple doesn’t have any good frameworks for implementing messaging between computers, especially on the listener (“server”) end. The best general purpose protocol right now is probably WebSockets, but there’s still no support for it in Apple’s frameworks, and it’s not easy to implement yourself.

We have several in house apps using DO over the LAN (in a 10.12 environment, in deployment since 10.5 or 10.4 if not earlier) and aside from security concerns for public use it has been great for implementing RPC.  We’ve had these services running for many years and they have been very stable.  As long as you know the demarcation between local and remote, things go smoothly. 

I am looking to implement some new functionality and wanted to make sure there was nothing I was overlooking.  I don’t think I’ll use DO as I’d like to not continue a dependency on outdated technology.  I would prefer to not have to implement my own protocol at a low level.

Any higher level options you can suggest would be appreciated.  The scenario is a launchd daemon running on multiple machines that can be controlled by a console app.  Send commands from the console app to the daemons, read statuses from the daemons.

Thanks!

Sandor


—Jens


Re: XPC Question

Ben Kennedy
 

On 18 Sep 2018, at 9:46 am, Jens Alfke <jens@...> wrote:

Unfortunately Apple doesn’t have any good frameworks for implementing messaging between computers, especially on the listener (“server”) end.
This thread would be incomplete without at least a nostalgic mention of Distributed Objects though!

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DistrObjects/Concepts/AboutDistributedObjects.html

(The revision history page is a sobering testament to its obsoleteness)

b


Re: XPC Question

 



On Sep 18, 2018, at 4:00 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

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

Not as far as I know.

In general, it’s a bad idea to use this sort of “hidden” RPC across a network. Networking is fundamentally unlike local function calls, and making a network call look exactly like a method call hides those differences and makes it easy to run into problems handling failures, dealing with protocol changes, enforcing security, and more.

Unfortunately Apple doesn’t have any good frameworks for implementing messaging between computers, especially on the listener (“server”) end. The best general purpose protocol right now is probably WebSockets, but there’s still no support for it in Apple’s frameworks, and it’s not easy to implement yourself.

—Jens


Re: iOS: TableView inside ScrollView

Steve Mills
 

On Sep 18, 2018, at 03:47:36, Gerriet M. Denkmann <g@...> 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@...> wrote:

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

- Jon


On Sep 17, 2018, at 8:56 AM, Dave <dave@...> 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@...> 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
>
>
> 
>



761 - 780 of 1475