Date   

Re: Updating to Xcode 10

John Brownie
 

Because it needs the GNU standard library. It's not just STL, but other things there that are different to the current standard library.

Alex Zavatone via Groups.Io wrote on 22/9/18 00:30:

How is this not solved by adding libc++.tbd to the project’s Link Binary With Libraries phase?

On Sep 21, 2018, at 8:52 AM, John Brownie <john_brownie@sil.org> wrote:

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and that solves the issue for now. I'd better get a move on with the Swift rewrite!

Thanks for all the help.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Re: Updating to Xcode 10

Alex Zavatone
 

How is this not solved by adding libc++.tbd to the project’s Link Binary With Libraries phase?

On Sep 21, 2018, at 8:52 AM, John Brownie <john_brownie@sil.org> wrote:

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and that solves the issue for now. I'd better get a move on with the Swift rewrite!

Thanks for all the help.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland



Re: Updating to Xcode 10

 



On Sep 21, 2018, at 1:33 AM, John Brownie <john_brownie@...> wrote:

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

Xcode stopped supporting the GNU C++ lib a few releases ago. You’ll need to use Clang’s libc++ instead. Hopefully there should be few compatibility problems.

—Jens


Re: More Layout Questions

Quincey Morris
 

On Sep 21, 2018, at 08:07 , Dave <dave@...> wrote:

I’m not sure what you mean, my storyboard file has Auto Layout DISABLED and there are no constraints anywhere in the project. Also, all the old-type layout options are off in the Size Panel in IB.

I mean that if you have disabled auto-layout, then you shouldn’t be trying to use auto-layout. Implementing the “layout” method comes under the heading of “trying to use auto-layout”, as the documentation says.

It may be possible that “layout” gets called anyway (it would have no effect unless you overrode it to do something), but the behavior isn’t documented in that case. You can’t rely on it to behave in any meaningful way.


Re: Updating to Xcode 10

Sean McBride
 

On Fri, 21 Sep 2018 16:52:32 +0300, John Brownie said:

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and
that solves the issue for now. I'd better get a move on with the Swift
rewrite!
How could rewriting in a different language be easier/faster than tweaking your C++ to work with a different STL library? Most C++ code should be agnostic towards which STL lib is being used anyway, no?

Sean


Re: More Layout Questions

Dave
 

I meant to say:

I’m not sure what you mean, my storyboard file has Auto Layout
DISABLED and there are no constraints anywhere in the project. Also, all the old-type layout options are off in the Size Panel in IB.




Re: More Layout Questions

Dave
 



On 21 Sep 2018, at 16:49, Quincey Morris <quinceymorris@...> wrote:

On Sep 21, 2018, at 05:36 , Dave <dave@...> wrote:

Using manual layout, does setting the “frame: of a view cause “layout” to be called or do I need to call “setNeedsLayout” specifically?

You seem to be way off base here. “Manual layout” is just the absence of auto-layout. The layout method is part of the auto-layout system, as the documentation says:

I’m not sure what you mean, my storyboard file has Auto Layout and there are no constraints anywhere in the project. Also, all the old-type layout options are off in the Size Panel in IB.

"Perform layout in concert with the constraint-based layout system.”


It’s a way of customizing auto-layout, not doing manual layout.

It sounds like you’re trying to auto-layout, but without any constraints. That’s certainly possible, but an auto-layout pass is still an auto-layout pass.

is there a particular way in which the NSView “layout” method is supposed to work or is it up to the developer to choose?

Yes, there’s a particular way. It needs to lay out its subviews (adjust the size and position of its subviews) by doing whatever isn’t being done by constraints. That means setting frames of its subviews. A view should not change *its own* frame in its "layout” method. That invalidates the layout of the superview, which is explicitly prohibited by the documentation you quoted.


Typical! The way I chose to do it, layout sets in own frame rectangle and calls layout on its subviews, however, it seems to work wonderfully, so not sure what is going on! Any comments?


At this point there are two options:

1. WindowTrackingView::layout simply calls “setNeedsLayout” for each of its subviews and each subview sets their own frame based on the “frame" rectangle of the superview via their own “layout” method.

No. Do *not* call “setNeedsLayout” from a “layout” method. That will trigger another layout pass, and layout will loop forever. As above, views are prohibited from setting their own frame in their own “layout” method.

It only calls setNeedsLayout on its subviews, not on itself, is this still not a good idea (it seems to work ok).


2.  WindowTrackingView::layout calculates and sets the frame of each of its subviews based on its own “frame” in this case and then calls “setNeedsDisplay” (unless this is already done if the “frame” changes?).

Do not call “setNeedsDisplay” routinely here. The “layout” method is about layout, and you aren’t concerned with drawing here. (If changing the layout resizes some subviews, the resizing itself will trigger drawing as necessary. That’s the normal consequence of resizing views. You don’t have to do anything extra.)

Noted, thanks.

But, yes, you need to set the frame of each subview that isn’t going to be (before "[super layout]”) or hasn’t been ("after [super layout]”) set by auto-layout constraints.

Not sure what you mean by this? There are no constraints define in this Storyboard/NIB.

In the following hierarchy:

WindowTrackerView .view)
SubviewA
SubviewB
SubviewC

WindowTrackerView::layout sets the frame of SubviewA.
SubviewA::layout sets the frame of SubviewB
SubviewB::layout sets the frame of SubviewC



Thanks a lot for the help
All the Best
Dave






























Re: More Layout Questions

Quincey Morris
 

On Sep 21, 2018, at 05:36 , Dave <dave@...> wrote:

Using manual layout, does setting the “frame: of a view cause “layout” to be called or do I need to call “setNeedsLayout” specifically?

You seem to be way off base here. “Manual layout” is just the absence of auto-layout. The layout method is part of the auto-layout system, as the documentation says:

"Perform layout in concert with the constraint-based layout system.”


It’s a way of customizing auto-layout, not doing manual layout.

It sounds like you’re trying to auto-layout, but without any constraints. That’s certainly possible, but an auto-layout pass is still an auto-layout pass.

is there a particular way in which the NSView “layout” method is supposed to work or is it up to the developer to choose?

Yes, there’s a particular way. It needs to lay out its subviews (adjust the size and position of its subviews) by doing whatever isn’t being done by constraints. That means setting frames of its subviews. A view should not change *its own* frame in its "layout” method. That invalidates the layout of the superview, which is explicitly prohibited by the documentation you quoted.

At this point there are two options:

1. WindowTrackingView::layout simply calls “setNeedsLayout” for each of its subviews and each subview sets their own frame based on the “frame" rectangle of the superview via their own “layout” method.

No. Do *not* call “setNeedsLayout” from a “layout” method. That will trigger another layout pass, and layout will loop forever. As above, views are prohibited from setting their own frame in their own “layout” method.

2.  WindowTrackingView::layout calculates and sets the frame of each of its subviews based on its own “frame” in this case and then calls “setNeedsDisplay” (unless this is already done if the “frame” changes?).

Do not call “setNeedsDisplay” routinely here. The “layout” method is about layout, and you aren’t concerned with drawing here. (If changing the layout resizes some subviews, the resizing itself will trigger drawing as necessary. That’s the normal consequence of resizing views. You don’t have to do anything extra.)

But, yes, you need to set the frame of each subview that isn’t going to be (before "[super layout]”) or hasn’t been ("after [super layout]”) set by auto-layout constraints.


Re: More Layout Questions

Sandor Szatmari
 

On Sep 21, 2018, at 08:36, Dave <dave@...> wrote:

Hi,

I have a couple of questions related to manual layout on the Mac.

Using manual layout, does setting the “frame: of a view cause “layout” to be called or do I need to call “setNeedsLayout” specifically?

Don’t know but should be empirical.

Sandor



In general, is there a particular way in which the NSView “layout” method is supposed to work or is it up to the developer to choose?


From the docs:

Override this method if your custom view needs to perform custom layout not expressible using the constraint-based layout system. In this case you are responsible for setting needsLayout to YES when something that impacts your custom layout changes.

You may not invalidate any constraints as part of your layout phase, nor invalidate the layout of your superview or views outside of your view hierarchy. You also may not invoke a drawing pass as part of layout.

You must call [super layout] as part of your implementation.

Should the “layout” method change the value of their “frame” property or should this be done by the superview?

I have a View Hierarchy and when the window resizes, I change the sizes and positions of the views within each subview. It seem to me that there are two ways of doing it given the following Hierarchy:

WindowTrackingView (.view)
LeftAreaView
ContainerViewA

RightAreaView
ContainerViewB

So, when the window resized, WindowTrackingView::layout gets called with its “frame” property set to the new size. 

At this point there are two options:

1. WindowTrackingView::layout simply calls “setNeedsLayout” for each of its subviews and each subview sets their own frame based on the “frame" rectangle of the superview via their own “layout” method.

2.  WindowTrackingView::layout calculates and sets the frame of each of its subviews based on its own “frame” in this case and then calls “setNeedsDisplay” (unless this is already done if the “frame” changes?).

Is any of these methods preferred or is it up to the developer to choose based on the job in hand?


Any help on this greatly appreciated, I’ve written a test app and have almost got my head around manual layout, I just need to understand if this last bit.

Thanks in advance.

All the Best
Dave
















Re: Updating to Xcode 10

John Brownie
 

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and that solves the issue for now. I'd better get a move on with the Swift rewrite!

Thanks for all the help.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Re: Adjusting Font Size to fit View Rectangle

Dave
 

This is a Mac project and those methods are not available…..

On 20 Sep 2018, at 19:58, Ben Kennedy <ben-groups@zygoat.ca> wrote:

On 20 Sep 2018, at 2:51 am, Dave <dave@looktowindward.com> wrote:

Those two methods alter the frame size, I want to keep the same Frame Size but reduce the Font Size of the Content until it fit into the Displayable Area. I’m 99% sure there is a method to do it but maybe its iOS only?
UILabel has `adjustsFontSizeToFitWidth` and `minimumScaleFactor` properties that aim to support that type of thing automatically. Could you employ it?

b




Re: Can NSView and NSImageView respond to Mouse Clicks?

Dave
 

Thanks a lot, I actually found this yesterday and now have it working using the mouseDown method to display a Popup - work a treat!

All the Best
Dave

On 20 Sep 2018, at 23:32, Jack Brindle via Groups.Io <jackbrindle@...> wrote:

NSView inherits from NSResponder. That gives NSView access to mouseDown, mouseUp and a whole host of other important calls. 
What this really means is that you can implement
- (void)mouseDown:(NSEvent *)event;
or
v- (void) mouseUp:(NSEvent *)event;
in your NSView subclass and handle mouse events the way you like, which includes generating IBAction calls to other objects that need to be notified of mouse events in your view.
The event object will contains information about where the cursor was when the mouse down or up even occurred, which you can use to determine exactly where in the view the hit occurred, and even when.
Note that any control embedded in the view will take precedence over the view itself, so that it gets a chance to handle the mouse down first. 

After all these years, I still find it really cool the way events and the responder chain works, and gives us so much power to create great user interfaces.

Jack



On Sep 20, 2018, at 4:36 AM, Dave <dave@...> wrote:

Hi,

This is for NSView, I’ve not looked into NSImageView as yet.

I tried adding a Gesture Recognizer which sort of work except the Handler gets calls more than nice when I mouse down.

Basically, I want to detect a Mouse Down on an NSView Subclass and when it occurs display a Pop-Up Menu. Don’t understand why I'm getting multiple calls - see code below.

All the Best
Dave

-(instancetype) initWithCoder:(NSCoder*) theDecoder
{
self = [super initWithCoder:theDecoder];
if (self == nil)
return nil;

NSLog(@"initWithCoder: %@",self.identifier);
[self setupView];

return self;
}


-(void) setupView
{
NSPressGestureRecognizer* myGestureRecognizer;

myGestureRecognizer = [[NSPressGestureRecognizer alloc] initWithTarget:self action:@selector(actionPressGesture:)];
myGestureRecognizer.minimumPressDuration = 0.001;
myGestureRecognizer.buttonMask = 1;
myGestureRecognizer.delaysPrimaryMouseButtonEvents = NO;
[self addGestureRecognizer:myGestureRecognizer];
}

-(void) actionPressGesture:(LTWTestViewCell*) theSender
{
NSLog(@"actionPressGesture: %@",self.identifier);
}


On 20 Sep 2018, at 02:03, Alex Zavatone via Groups.Io <zav@...> wrote:

You can add a gesture to it IIRC.
On Sep 19, 2018, at 1: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.

All the Best
Dave













More Layout Questions

Dave
 

Hi,

I have a couple of questions related to manual layout on the Mac.

Using manual layout, does setting the “frame: of a view cause “layout” to be called or do I need to call “setNeedsLayout” specifically?


In general, is there a particular way in which the NSView “layout” method is supposed to work or is it up to the developer to choose?


From the docs:

Override this method if your custom view needs to perform custom layout not expressible using the constraint-based layout system. In this case you are responsible for setting needsLayout to YES when something that impacts your custom layout changes.

You may not invalidate any constraints as part of your layout phase, nor invalidate the layout of your superview or views outside of your view hierarchy. You also may not invoke a drawing pass as part of layout.

You must call [super layout] as part of your implementation.

Should the “layout” method change the value of their “frame” property or should this be done by the superview?

I have a View Hierarchy and when the window resizes, I change the sizes and positions of the views within each subview. It seem to me that there are two ways of doing it given the following Hierarchy:

WindowTrackingView (.view)
LeftAreaView
ContainerViewA

RightAreaView
ContainerViewB

So, when the window resized, WindowTrackingView::layout gets called with its “frame” property set to the new size. 

At this point there are two options:

1. WindowTrackingView::layout simply calls “setNeedsLayout” for each of its subviews and each subview sets their own frame based on the “frame" rectangle of the superview via their own “layout” method.

2.  WindowTrackingView::layout calculates and sets the frame of each of its subviews based on its own “frame” in this case and then calls “setNeedsDisplay” (unless this is already done if the “frame” changes?).

Is any of these methods preferred or is it up to the developer to choose based on the job in hand?


Any help on this greatly appreciated, I’ve written a test app and have almost got my head around manual layout, I just need to understand if this last bit.

Thanks in advance.

All the Best
Dave
















Re: Updating to Xcode 10

John Brownie
 

Oh boy. I am only targeting macOS (10.9 for this release), so it should still be doable. This will be a stop-gap while I work on the migration of the whole code base to Swift. I'm relying on a third-party base, Nano, which is coded with the GNU stdlib in mind, and that's one more reason to move to Swift.

In the meantime, is it going to be possible to add a version of libstdc++ to Xcode? Given code signing and all that, I guess it wouldn't be possible to stick it into the SDK, so it would have to be /usr/include or /usr/local/include. Is the best way to go through the whole gcc installation, or is there a shortcut I can make?

Thanks for pointing out the release notes. Life is too short to read everything when trying to catch up after several months away from the project!

John

Jack Brindle via Groups.Io wrote on 21/9/18 15:22:

John;

It’s usually a good thing to read the release notes for each version of Xcode. The Xcode 10 release notes directly mention the issue you are facing:

Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of macOS 10.9 or later, or iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)

Libgcc is obsoleted. Xcode 10 can no longer build apps with deployment targets of macOS 10.4 and 10.5. (42818150, 38035243) 


It looks like they really want you to change libraries to use libc++.

Jack


On Sep 21, 2018, at 3:33 AM, John Brownie <john_brownie@...> wrote:

I discovered one thing that is a bug in Xcode. In the section Apple Clang - Language - C++, if you set the C++ Standard Library to the option libstdc++ (GNU C++ Standard Library), it generates the -std=libstdc++. When it fails to find it, it generates the erroneous warning.

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

John

Alex Zavatone via Groups.Io wrote on 20/9/18 21:24:
Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland






--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland





--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Re: Updating to Xcode 10

Jack Brindle
 

John;

It’s usually a good thing to read the release notes for each version of Xcode. The Xcode 10 release notes directly mention the issue you are facing:

Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of macOS 10.9 or later, or iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)

Libgcc is obsoleted. Xcode 10 can no longer build apps with deployment targets of macOS 10.4 and 10.5. (42818150, 38035243) 


It looks like they really want you to change libraries to use libc++.

Jack


On Sep 21, 2018, at 3:33 AM, John Brownie <john_brownie@...> wrote:

I discovered one thing that is a bug in Xcode. In the section Apple Clang - Language - C++, if you set the C++ Standard Library to the option libstdc++ (GNU C++ Standard Library), it generates the -std=libstdc++. When it fails to find it, it generates the erroneous warning.

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

John

Alex Zavatone via Groups.Io wrote on 20/9/18 21:24:
Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland






--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland





How to end a UIKeyboardTypeDecimalPad

Gerriet M. Denkmann
 

I got a UITextField which has a UIKeyboardTypeDecimalPad.

With a normal TextField (UIKeyboardTypeDefault) the user can enter Return, the UITextFieldDelegate gets textFieldShouldReturn and all is well.

But how should the user tell the app that enough digits have been entered, as the DecimalPad has no Return key?


Gerriet.


Re: Updating to Xcode 10

John Brownie
 

I discovered one thing that is a bug in Xcode. In the section Apple Clang - Language - C++, if you set the C++ Standard Library to the option libstdc++ (GNU C++ Standard Library), it generates the -std=libstdc++. When it fails to find it, it generates the erroneous warning.

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

John

Alex Zavatone via Groups.Io wrote on 20/9/18 21:24:

Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@sil.org> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Re: Segue

Quincey Morris
 

On Sep 20, 2018, at 22:50 , Gerriet M. Denkmann <g@...> wrote:

This is probably self-evident (and probably also well documented),

It is self-evident after you read the documentation, but it takes about a day to read the documentation …

but it took me more than a day to figure this out.

… and if you’d spent the day reading the documentation, it wouldn’t have taken a day to figure out. ;)

TBH, it’s a bit frightening how abstruse the controller interactions have become on iOS over the years. If you study the master-detail app template in Xcode, you’ll see that it gives the iPad *both* a split view controller *and* a navigation controller, and it switches between the two dynamically, depending on how the split view interacts with a compact dimension.

If you want to make your head hurt, you can spend another day figuring out how the machinery in the App Delegate and the MasterViewController, and the cross-linked navigation controllers in the storyboard all work together to do some very clever things. I particular like this comment in the helper method near the end of the App Delegate:

            // Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.

This is quite a strange rabbit hole to disappear into.


Re: Segue

Gerriet M. Denkmann
 

On 20 Sep 2018, at 22:19, Rick Aurbach via Groups.Io <rlaurb=me.com@groups.io> wrote:

I'm not sure I am understanding your problem correctly, but I am wondering about the exact layout of your storyboard. Specifically, are you using a UISplitViewController? The Push (Detail) segue is specific to it.

On an iPhone (particularly in portrait mode), the push-detail segue looks like a simple push, but it is not. You can see this when running on an iPad in Simulator, where you will see both the TableViewController and the Detail controller (in whole or with part of it covered by the TableViewController) side by side. The push detail segue brings the detail controller to the front, covering (hiding) the TableViewController. On a phone, this just looks like a push.

If you don't have a split-view controller, then the segue can't do that (i.e., it can't call UISplitViewController.showDetailViewController) and is apparently doing a simple UIViewController.present instead.

If I’m off on a mistaken tangent here, please excuse the waste of bandwidth.
You are quite right. The Xcode template “Master-Detail App” uses a SplitViewController, and it works fine.
And it works for both iPad and iPhone.

But you can do (iPhone only ?) without a SplitViewController as well:

UINavigationController → UIViewController (Master) → UIViewController (Detail) works as expected.

Three important points:
1. The Master *must* be preceded by an UINavigationController
2. There must be *no* UINavigationController between Master and Detail.
3. The Segue Master to Detail *must* be of Kind: Show (e.g. Push)

This is probably self-evident (and probably also well documented), but it took me more than a day to figure this out.

Kind regards,

Gerriet.


Re: Can NSView and NSImageView respond to Mouse Clicks?

Jack Brindle
 

NSView inherits from NSResponder. That gives NSView access to mouseDown, mouseUp and a whole host of other important calls.
What this really means is that you can implement
- (void)mouseDown:(NSEvent *)event;
or
v- (void) mouseUp:(NSEvent *)event;
in your NSView subclass and handle mouse events the way you like, which includes generating IBAction calls to other objects that need to be notified of mouse events in your view.
The event object will contains information about where the cursor was when the mouse down or up even occurred, which you can use to determine exactly where in the view the hit occurred, and even when.
Note that any control embedded in the view will take precedence over the view itself, so that it gets a chance to handle the mouse down first.

After all these years, I still find it really cool the way events and the responder chain works, and gives us so much power to create great user interfaces.

Jack

On Sep 20, 2018, at 4:36 AM, Dave <dave@looktowindward.com> wrote:

Hi,

This is for NSView, I’ve not looked into NSImageView as yet.

I tried adding a Gesture Recognizer which sort of work except the Handler gets calls more than nice when I mouse down.

Basically, I want to detect a Mouse Down on an NSView Subclass and when it occurs display a Pop-Up Menu. Don’t understand why I'm getting multiple calls - see code below.

All the Best
Dave

-(instancetype) initWithCoder:(NSCoder*) theDecoder
{
self = [super initWithCoder:theDecoder];
if (self == nil)
return nil;

NSLog(@"initWithCoder: %@",self.identifier);
[self setupView];

return self;
}


-(void) setupView
{
NSPressGestureRecognizer* myGestureRecognizer;

myGestureRecognizer = [[NSPressGestureRecognizer alloc] initWithTarget:self action:@selector(actionPressGesture:)];
myGestureRecognizer.minimumPressDuration = 0.001;
myGestureRecognizer.buttonMask = 1;
myGestureRecognizer.delaysPrimaryMouseButtonEvents = NO;
[self addGestureRecognizer:myGestureRecognizer];
}

-(void) actionPressGesture:(LTWTestViewCell*) theSender
{
NSLog(@"actionPressGesture: %@",self.identifier);
}


On 20 Sep 2018, at 02:03, Alex Zavatone via Groups.Io <zav=mac.com@groups.io> wrote:

You can add a gesture to it IIRC.
On Sep 19, 2018, at 1:34 PM, Dave <dave@looktowindward.com> 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.

All the Best
Dave




701 - 720 of 1454