How to add a table to a NS/UITextView in Swift? - ios

I can see in Apple Notes and other notes app that they have tables embedded into the text editor. Swift has NSTextTable, but it's just available for macOS. I'm wondering how I can add a table to both, macOS and iOS?
In addition, these tables should be interactive like in Apple Notes, like I can add a row or column, move them around, etc. I have seen this project which enables you to embed a NS/UIView into the editor, but this seems more like a hack.
Any ideas?

I think that there is no simple way to add such attachments to a textView on iOS, you may try to find something in NSAttributedString, but probably it won't have a solution, so https://github.com/vlas-voloshin/SubviewAttachingTextView looks like a good option.

Related

How to use Swift Playgrounds-style code input keyboard/text field in normal text view?

I'm making an iPad app that lets me write swift code into a text box and save it to a document. It doesn't do any compilation or any complicated stuff like that, so I'm just looking for a way to format the code correctly in the text box (ex: code autocomplete, autoindent if possible, and maybe syntax highlighting). In short, I'd like my app's text field and keyboard to look similar to those of Swift Playgrounds.
If Apple's provided the code (or a built-in keyboard option that can do even some of this), I'd appreciate a link to it. Otherwise, how would I go about building a custom keyboard and text field (or at least disable the features like autocomplete that would get in the way)?
Thanks.
As far as I know the only way to do what you describe is to build a Swift Playgrounds app that presents a code editor window. Apple does provide documentation on creating third party iPad Swift playgrounds. I suggest looking it up on Apple's site.

Use stock keyboard as template for custom iOS 8 keyboard

I was wondering if it is possible to get the stock Apple keyboard design as a file to make a own custom keyboard with only slight changes to the original one.
I would like to only change one Key and was hoping that I don't have to build the whole design myself and try to imitate the original design.
Thanks in advance
I built a custom keyboard with the same look as the system keyboard (except it has only one "letter" key!): https://github.com/acoomans/ACKeyboard
I'm sure you can start from there and adapt it to your need. Good luck!
There is another custom keyboard with all the keys here. Looks like the might be a bit hacked together but could be another good place to start. https://github.com/archagon/tasty-imitation-keyboard

How do I go about building a native iOS rich text editor?

We want a native rich text editor because we are trying to stay away from using Javascript and webviews for this solution.
We've tried many things so far, and we're left with quite a few obstacles that we just can't get around. Let me break it down into questions that I hope you can answer.
I have a UIButton, that says "B" on it, and I want to put it into the 'selected' state when a user sets 'Bold' from using the TextView's long-press gesture on a selection. How do I register for this state change? I tried adding an observer on the textView.attributedText, but it doesn't seem they are changing that dictionary, but instead are updating it. NSDictionary has no way, as far as I know, to add observers on the dictionary's keys. So I'm stuck with noticing this change.
Regarding number 1, I also tried setting the textView's inputDelegate and it seems that the method - (void)textDidChange:(id )textInput never gets called. :( Docs says is should. What did I do wrong?
How do I update the attributedText weight when I hit my bold italic or underline button.
How do I convert my attributed text into HTML?
I saw a few neat libraries for number 4, but I'm still curious what you'd come up with. (Broadens my options). But, I can't really work on number 4 until I figure out how to do the previous 3.
This editor will also need hyperlinks, bulleted lists, and numbered lists, more things I imagine I'll struggle through, but if you could answer the 4 questions above, that will keep me held over for a while. :)
Thanks!
Here is a link to an iOS rich text editor I've been working on.
https://github.com/aryaxt/iOS-Rich-Text-Editor
There is still a lot of work that has to be done, but the basic features are there.
The Apple sample application called 'TextEdit' does much of what you've described and, if not that, would be a very good starting point. Find the sample code with a search in the Organizer.
There is a commercial editor based on the DTCoreText library. I've used that library but not the rich text editor. Look at the Cocoanetics web site. It's not cheap but will save you a ton of work.

Is it possible to use Monotouch.Dialog to create a custom list like this?

I just discovered Xamarin Studio and Monotouch.Dialog, and I've been doing a lot of research on custom table cells. So far I've been pretty successful experimenting with some of the features, but I'm having trouble figuring out how to create something like this:
All of the samples I have seen still look like a standard iOS table view, with maybe a few colors changed here and there. My goal is to create truly customized cells, with customized spacing and what not. I'm not sure if this is even possible, so I figured I would ask you guys.
Thanks in advance.
Yes, you can create an OwnerDrawnElement. There's an explanation of this in the Owner-Drawn Element section of this doc:
http://docs.xamarin.com/guides/ios/user_interface/monotouch.dialog
There's also a sample here:
https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/Elements/OwnerDrawnElement.cs

iOS - Display grid of icons to select

I'm looking to create a grid of icons from which one can be selected (see the Daytum app for an example of this).
Are there any existing form entry frameworks for iOS that already support this (eg QuickDialog is excellent, but doesn't support this)
What would be the best way to implement this? Assuming selecting an icon brings the user back to a form field with the icon populated in the field.
Are there any other apps apart from Daytum that use this 'model?
Three20 has a grid view controller, that makes it pretty easy to add icons in a grid.
I'm a huge fan of AQGridView. Used it in a couple of projects and i think its really really built well and easy to implement.

Resources