iPhone Number Text To A Full Currency Equation [duplicate] - objective-c

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Struggling with currency in Cocoa
Re-Apply currency formatting to a UITextField on a change event
I have been all over the web and either examples are no longer valid or people didn't really know what they were doing.
So i have come to you guys for help,
I need to get a a textbox(TextField) to Display when they click into it a "$"...that was Easy lol
but i also need from the dollar sign to $0.00 then $0.01, $0.10 and so on.
And save an instance of it without the Symbols.
I am very new to Objective C and would like maybe a simple explanation or even a good blog to read about it. "only if you just recently read it and its not outdated"

You want to use NSNumberFormatter to accomplish this. The NSNumberFormatter documention from Apple is very good (I've just re-read it and it's not outdated). Specifically, look at the section on Configuring the Format of Currency. This should be enough to get you started.
Another good place to look if you prefer examples to documentation, is to read through the section on Number Formatters from Apple's Data Formatting Guide. This goes through examples of how to set up currency formatters to your specifications with concrete examples.
Finally, in order to integrate this with a UITextField, you will want to use the delegate method
– textField:shouldChangeCharactersInRange:replacementString:
This allows you to validate and update characters as the user types them in.

Related

Scenario Outline And Examples in karate [duplicate]

This question already has an answer here:
In Karate Scenario Outline test, how to pass param values in the Examples table through a variable
(1 answer)
Closed 1 year ago.
I want to run my scenario with all the images that i have in my resource folder. meaning every time hitting same api with different image(converting them to base64encoding first) .But as this images already are in resource folder than it does not make sense to save with some name or records in csv for scenario outline purpose. Can i call a my own function (having code to take the image from resource folder and convert it into base64) in Examples section , So that for every image it will hits the same api again.
Yes. First write some java code to get a list of the image files. You can refer this code for ideas: https://stackoverflow.com/a/65035825/143475
If that is too hard, then just create a CSV file with a list of paths. Let me say that Karate is designed for testing, but you seem to be expecting something else. Karate is not a "general purpose" programming language. But it can be made to do extreme things by Java interop.
One you have a JSON array, then it can be used as the data-source for the Examples: section: https://github.com/intuit/karate#json-array-data-source
You can refer other answers for Base64 conversion: https://stackoverflow.com/a/46452864/143475
All the things you want to do is possible, but please do some research and try. And the next time you ask a question, please show what you tried and give examples instead of just a broad question, thanks.

How can I edit text that has already been printed in Console in VB.NET?

This question is certainly a duplicate: I remember reading the answer years ago. Unfortunately I wasn't able to find the link either by searching SO or Google, so I'm forced to ask again. Apologies.
What I'm trying to do is print text in a Console application, which the user can then edit and modify, and then press Enter to change the value of. I know that I can intercept the user's keypresses, determine intelligently what to do with them, and use Console.SetCursorPosition to dynamically change the text.
However, I know for sure that there was a hacky one line solution I read on an answer ages ago (which worked, but was not recommended,) and I can't remember what it was.
Does anyone know what this solution is, or have a link to the post I'm looking for?

How to create documentation for instance variable and methods in Xcode?

I'd like to be able to Alt-Click an instance variable (or a method) as part of the program i created and read what it's purpose is.
The fact that Xcode is telling me the class variable is declared at - is nice but not enough. In this case i'd like to see custom text i typed to describe what an asset really is. Additionally type of the ivar would also be useful to know.
How can this be done? In this case, i wonder what exactly did i mean by assets
I specifically wonder if this information can be viewed from inside Xcode, similar to how Eclipse shows JavaDoc content.
You would need to create a documentation set for your project and install it in Xcode. appledoc can help you with this. This is a command-line tool that can generate documentation in Apple's style from specially formatted comments in your headers. You can also integrate this into your build process with a run script build phase, so that documentation is always up-to-date.
For small projects, it's usually not worth the effort though and you're probably better off just adding comments to your header files and jumping there with Cmd-click (Ctrl+Cmd+left-arrow to go back to where you came from).
You'll probably want to take a look at Apple's documentation on Documentation Sets as well as their article on generating doc sets using Doxygen. The latter is based on Xcode 3.x, so how relevant it is is somewhat questionable, but it'd be a good idea to take a look nonetheless.
That said, if you decide to use Doxygen (alternatives like HeaderDoc can be used for documentation, but I'm not sure what's available to you as far as creating doc sets goes), it looks like the main point is you'll want to throw GENERATE_DOCSET=YES into your Doxyfile (or whatever you decide to call it). After that, you'd just throw the results into ~/Library/Developer/Shared/Documentation/DocSets (according to Doxygen's documentation). I don't know whether this works in Xcode 4.x - it's worth a shot though, and it'd be nice to hear back on it.
Note: most of this was based on this answer by Barry Wark. Figure credit is due there, since I wouldn't have bothered looking into this were it not for his answer.

Make a video from an NSArray of NSImages

I know this has been asked before, but the only answers I have found use UIImages. I need to make a 25 fps video from an NSArray of NSImages in Objective-C. Could somebody give me a link to the documentation dealing with this (if there is any), or tell me how I can do it?
NOTE: I will also need to know which frameworks to use if there is no documentation on this. And, before you ask, I have done lots of searches for the documentation.
You can do this with QTKit by creating a movie and adding images as frames. See the "Creating a Single Frame-Grabbing Application" section. Step 13 specifically demonstrates how to add an image (and have it last a specific duration in the movie ... should probably last more than a single frame for, say, stop-motion stuff).

How to implement an NSTextView that performs on-the-fly markup to RTF conversions

I'm trying to build an NSTextView that can take "marked up" input that is automatically translated into beautiful RTF-style text while the user types.
The idea is to let the user enter text in "plain text" format, but to "beautify" it on the spot, e.g.
H1 A quick list:
* first item
* second item
would be translated into a first line with a header font, followed by a bulleted list.
I have found plenty of potential ways of doing this, but the Text System is incredibly complicated (with reason) and I don't want to start "cooking my own" if there is already something suitable built-in. BTW I would be happy with a Snow Leopard only API.
The first thing I thought of was "data detectors", but I can't find a public API for doing this.
Having reached the end of the road with that, I turned to the new "Text Input Sources API". This does all kinds of things, but the "data-driven input methods" section of the WWDC 2006 presentation "Take Charge of the Text Input" seems interesting in my context. Beyond that single presentation slide however nothing seems to exist anywhere, so it's a bit of a dead end again.
Finally, I had a look at the NSSpellChecker class which is also supposed to offer completion features and automatic corrections.. but I'm not sure how this could be re-purposed for my requirements either.
At the moment, I'm tempted to just re-parse the entire NSTextStorage manually and make the changes myself when the user stops typing.. but I'm sure there are cleverer heads around this forum..
Any advice or pointers in the right direction would be greatly appreciated.
Neither data detectors nor the spell checker are appropriate for this task. Assuming you're just looking for a way to pass the input to a parser/formatter you already have, interfacing with the text system isn't too difficult. You're on the right track with handling the editing to NSTextStorage.
Along those lines, there's no need to re-parse the entire thing when the user stops. The text system sends you the modified range and gives you the opportunity to act on those changes (and even reject them out of hand). Since all changes funnel through this (typing, pasting, dropping...), this is the point where you want to intercede.
Because you're dealing with headings and bulleted lists, I'd get the enclosing paragraph of the modified range. This gives you a nice, round unit of work that is easily discovered and perfectly fits what you're trying to accomplish.
Good luck!