Re: Updating to Xcode 10
Jack Brindle
John;
toggle quoted messageShow quoted text
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
|
|
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.
toggle quoted messageShow quoted text
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: --
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:
It is self-evident after you read the documentation, but it takes about a day to read the documentation …
… 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.
|
|
Re: Segue
Gerriet M. Denkmann
On 20 Sep 2018, at 22:19, Rick Aurbach via Groups.Io <rlaurb@...> wrote: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.
toggle quoted messageShow quoted text
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:
|
|
Re: Can NSView and NSImageView respond to Mouse Clicks?
Sean McBride
On Thu, 20 Sep 2018 11:36:10 +0200, Dave said:
Basically, I want to detect a Mouse Down on an NSView Subclass and whenSuggestion: open NSView.h and search for "menu", there are API like menuForEvent: and willOpenMenu: that look useful for your case. Cheers, Sean
|
|
Re: Updating to Xcode 10
Alex Zavatone
Did you change your linked library to the new C++ one?
toggle quoted messageShow quoted text
On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:
|
|
Re: Adjusting Font Size to fit View Rectangle
On 20 Sep 2018, at 2:51 am, Dave <dave@...> wrote:UILabel has `adjustsFontSizeToFitWidth` and `minimumScaleFactor` properties that aim to support that type of thing automatically. Could you employ it? b
|
|
Re: Updating to Xcode 10
I build a lot of C++ and I don’t think I’ve ever seen that. Are you overriding the header search path or specifying any exotic compiler flags already? And double-check that you’ve got a valid SDK selected. ‘-std=libc++’ seems fishy to me, since the value of -std is supposed to be a language version like “c++11”. —Jens
|
|
Re: Adjusting Font Size to fit View Rectangle
Alex Zavatone
You also might want to check the height of a descender appears below the bounding NSTextField.
toggle quoted messageShow quoted text
On Sep 20, 2018, at 5:21 AM, Dave <dave@...> wrote:
|
|
Re: Segue
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. Rick Aurbach
|
|
Re: Adjusting Font Size to fit View Rectangle
Sandor Szatmari
Yes, I’m sure single line (text field) instead of multiline (text view) can be accomplished with less rigor. Let me know if you find anything interesting.
toggle quoted messageShow quoted text
Sandor
On Sep 20, 2018, at 09:12, Dave <dave@...> wrote:
|
|
Re: Adjusting Font Size to fit View Rectangle
Alex Zavatone
I do think that based on your requirements, there will have been others who have solved this. I just found a few solutions on Stack Overflow that could be adopted to MacOS.
toggle quoted messageShow quoted text
Will send off list.
On Sep 20, 2018, at 4:51 AM, Dave <dave@...> wrote:
|
|
Re: Adjusting Font Size to fit View Rectangle
Dave
Hi,
toggle quoted messageShow quoted text
I think it should work ok on iOS, will find out soon, there maybe some differences in method names etc. I should have been more clear, this is for a single line, it should work for multiple lines too, but probably not as well as your suggestion, which is overkill for what I want it for. All the Best Dave
|
|
Re: Adjusting Font Size to fit View Rectangle
Sandor Szatmari
This was for macOS… not sure how to go about it on iOS. I’d guess it would work, but there may be an easier method. I don’t know though.
toggle quoted messageShow quoted text
I have used this method to dynamically size formatted multiline text (text that includes line breaks) to find the maximum font size for a fixed container size. Granted there may be an easier solution that I am not aware of, but I am also counting the number of line of text being laid out, so this solution works for me. 1. Get text 2. Setup your mutable paragraph style, set properties, justification, wrapping… etc. 3. Create a layout manager… set properties, hyphenation, etc. Important, set the layout mgr’s delegate (I used self for simplicity). You will receive callbacks about the layout process via delegation. 3a. Define delegate method -layoutManager:didCompleteLayoutForTextContainer:atEnd: (you will receive these callbacks where you can flag ‘clipping’ I.e. text too big) set a flag here indicating clipping has occurred. I used an iVar. 4. Create a mutable attributes dict, this contains the para style keyed on NSParagraphStyleAttributeName. (You will add/update the font later stored in this dict with different sizes later) 5. Create a text storage object with text and para style 6. Now loop… do while (notClipped && other things you care about) Loop Body a. Adjust font size b. Create new NSFont object with new size. Set font in attributes dict keyed on NSFontAttributeName c. Adjust paragraph style as needed/desired (optional) d. Reapply (Set) the updated attributes dict for the entire range of text in your text storage object -setAtteibutes:range: e. Ask the layout manager/text storage to layout the text. If the text is too big the container parameter in your callback will be nil indicating that ‘clipping’ occurred. Use nil container to flag clipping thus communicating with your loop. Rinse, repeat… till desired font size reached The text generated using this approach is displayed in widgets that are part of a complex visual graph of objects all of which are the same size and which contain dynamic multiline text. I have additional logic that counts the number of lines to ensure that there are always three lines. Each line contains a different property of the object being represented. IP, hostname, etc… Think graphical displays of networks and such, with text inside the network components. Sandor
On Sep 20, 2018, at 05:51, Dave <dave@...> wrote:
|
|
Adding Action Methods to Controls
Dave
Ignore this, was a silly bug in that the identifier wasn’t setup correctly!
|
|
Adding Action Methods to Controls
Dave
Hi,
I’ve created an NSButton Class and added an Action to it as so: myButton = [[NSButton alloc] initWithFrame:myButtonFrameRect]; myButton.image = myImage; myButton.imageScaling = NSImageScaleProportionallyUpOrDown; self.pCellButton = myButton; self.pCellButton.target = self; [self.pCellButton sendActionOn:NSEventMaskLeftMouseDown]; [self.pCellButton setAction:@selector(performCellSelected:)]; [self addSubview:self.pCellButton]; -(void) performCellSelected:(id) theSender { NSLog(@"performCellSelected: theSender: %@", theSender.identifier); } This works ok, EXCEPT the parameter pass in “theSender” is nil???? I would have thought it should be the NSButton object that the Action was sent from is this not the case? All the Best Dave
|
|
Re: Adjusting Font Size to fit View Rectangle
Dave
Hi,
toggle quoted messageShow quoted text
Couldn’t find it so wrote my own: (NSInteger) adjustFontSize:(NSInteger) theFontSize toFitWidth:(NSInteger) theWidth { NSInteger myFontSize; NSFont* myFont; NSSize myContentSize; myFontSize = theFontSize; while (YES) { myFont = [NSFont fontWithName:self.font.fontName size:myFontSize]; [self setFont:myFont]; myContentSize = [self.attributedStringValue size]; if (myContentSize.width < theWidth) break; myFontSize--; if (myFontSize <= 0) break; } return myFontSize; } This is on an NSTextField subclass and works a treat! All the Best Dave
On 20 Sep 2018, at 11:51, Dave <dave@...> wrote:
|
|
Re: Adjusting Font Size to fit View Rectangle
Dave
Hi,
toggle quoted messageShow quoted text
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? All the Best Dave
On 20 Sep 2018, at 02:02, Alex Zavatone via Groups.Io <zav@...> wrote:
|
|