Skip to content

Commit 14973b0

Browse files
author
Darcy Liu
committed
add SimpleTextInput
1 parent 535295b commit 14973b0

24 files changed

Lines changed: 3085 additions & 0 deletions

SimpleTextInput.zip

53.5 KB
Binary file not shown.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
File: EditableCoreTextView.h
3+
Abstract:
4+
A view that illustrates how to implement and use the UITextInput protocol.
5+
6+
Heavily leverages an existing CoreText-based editor and merely serves
7+
as the "glue" between the system keyboard and this editor.
8+
9+
Version: 1.0
10+
11+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
12+
Inc. ("Apple") in consideration of your agreement to the following
13+
terms, and your use, installation, modification or redistribution of
14+
this Apple software constitutes acceptance of these terms. If you do
15+
not agree with these terms, please do not use, install, modify or
16+
redistribute this Apple software.
17+
18+
In consideration of your agreement to abide by the following terms, and
19+
subject to these terms, Apple grants you a personal, non-exclusive
20+
license, under Apple's copyrights in this original Apple software (the
21+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
22+
Software, with or without modifications, in source and/or binary forms;
23+
provided that if you redistribute the Apple Software in its entirety and
24+
without modifications, you must retain this notice and the following
25+
text and disclaimers in all such redistributions of the Apple Software.
26+
Neither the name, trademarks, service marks or logos of Apple Inc. may
27+
be used to endorse or promote products derived from the Apple Software
28+
without specific prior written permission from Apple. Except as
29+
expressly stated in this notice, no other rights or licenses, express or
30+
implied, are granted by Apple herein, including but not limited to any
31+
patent rights that may be infringed by your derivative works or by other
32+
works in which the Apple Software may be incorporated.
33+
34+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
35+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
36+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
37+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
38+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
39+
40+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
41+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
44+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
45+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
46+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
47+
POSSIBILITY OF SUCH DAMAGE.
48+
49+
Copyright (C) 2011 Apple Inc. All Rights Reserved.
50+
51+
*/
52+
53+
#import <UIKit/UIKit.h>
54+
55+
#import "SimpleCoreTextView.h"
56+
57+
@class EditableCoreTextView;
58+
59+
// EditableCoreTextViewDelegate - simple delegate protocol to notify when the EditableCoreTextView
60+
// becomes first responder
61+
@protocol EditableCoreTextViewDelegate
62+
- (void)editableCoreTextViewWillEdit:(EditableCoreTextView *)editableCoreTextView;
63+
@end
64+
65+
// EditableCoreTextView - Main custom text view that handles text input and draws text
66+
// (using contained SimpleCoreTextView)
67+
@interface EditableCoreTextView : UIView <UITextInput> {
68+
SimpleCoreTextView *_textView;
69+
NSMutableString *_text;
70+
NSDictionary *_markedTextStyle;
71+
id <UITextInputDelegate> _inputDelegate;
72+
UITextInputStringTokenizer *_tokenizer;
73+
id <EditableCoreTextViewDelegate> _editableCoreTextViewDelegate;
74+
}
75+
76+
@property (nonatomic, retain) id <EditableCoreTextViewDelegate> editableCoreTextViewDelegate;
77+
78+
@end

0 commit comments

Comments
 (0)