-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,7 @@ | ||
Chromatism | ||
========== | ||
|
||
This is an experimation of a Syntax Highlighting textView using a tableView and CoreText. It consists of a UITextView with a UITableVIew overlay. The UITextView has its textColor set to `[UIColor clearColor]` and ints only purpose is to provide a textinput. Ontop of the textView there is a `UITableView`, which render the lines currently visible. | ||
## iOS 7 | ||
Most of this code will be thrown away in favor for new iOS 7 features. | ||
|
||
## Bugs | ||
At this moment there are *a lot* of bugs that need fixing. This is an experiment and a work in progress. | ||
|
||
##This is what happens when the text editor is created: | ||
|
||
1. The text is broken up into lines by a CTTypesetter and stored in an array. | ||
2. The tableview asks for the lines that should be visible. | ||
3. The tableView creates UITableViewCells which draw the lines. | ||
|
||
##What happens upon scrolling: | ||
1. The tableView takes the cells that go offscreen and reuse them by telling them to draw new lines. Cells still onscreen are not redrawn. | ||
|
||
##What happens upon text change: | ||
1. What type of text change is it? | ||
2. If it can be handled by slightly modifying the lines, do so. No typesetter is required to look through the entire text. | ||
3. If not there is no option but to recalculate everything with the typesetter. | ||
|
||
|
||
|
||
The tokenizing itself uses regex to modify an attributed string. The tokenizer tries to tokenizer as little as possible. If the user types a letter most regex patterns are going to be applied to the current line. | ||
|
||
##Performance | ||
Performance is the whole reason Chromatism was created. | ||
|
||
###Screenshot of Time Profiling: | ||
![Alt text](http://anviking.com/Time.png "Performance") | ||
This is the beginning of a syntax highlighting `UITextView` for iOS. Currently it only knows about Obj-C. Previous Chromatism used a combination of `CoreText` and `UITableView` for performance, but luckily that is not needed anymore. | ||
|
||
|
||
|