我是靠谱客的博主 忧郁摩托,这篇文章主要介绍ios中经过调试来使用私有ipa,现在分享给大家,希望可以做个参考。

原文地址: http://www.myexception.cn/operating-system/1398657.html
ios中通过调试来使用私有ipa

       iOS不允许使用ios私有ipa,使用私有ipa可以获得意想不到的效果 ,同时使用私有ipa是一个程序员的技术体现之一。至于怎么通过apple的审核,其实是有些办法的,但是不属于今天讨论的范围。私有ipa可以通过dump头文件获得,也可以去github clone一份现成的,但是还是推荐自己去dump。但是我们今天不是讨论,如何使用dump到的ipa,而是通过一个例子来讨论如何通过查看头文件使用私有api。

      我们以UITextfield为例,其实这是个比较简单的控件,有一个蓝色输入的光标,可以在你输入的时候隐藏或者显示,但是并没有给我们提供改变光标颜色的接口,这个时候我们如果要改变光标的颜色,必然要使用私有ipa(或者通过比较啰嗦的办法来做这这件事情)。
     我们首先需要dump一包头文件,如何class-dump,不是我们今天讨论的要点,现在我们贴上UITextfield的头文件。如果你觉得很长,直接拖到最后面。


 

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
#import #import "NSCoding.h" #import "UIPopoverControllerDelegate.h" #import "UITextInput.h" @class NSArray, NSAttributedString, NSDictionary, NSString, UIButton, UIColor, UIFont, UIImage, UIImageView, UILabel, UITextFieldAtomBackgroundView, UITextFieldBackgroundView, UITextFieldBorderView, UITextFieldLabel, UITextInputTraits, UITextInteractionAssistant, UITextPosition, UITextRange, UIView, _UIBaselineLayoutStrut, _UITextServiceSession; @interface UITextField : UIControl { NSAttributedString *_text; UIColor *_textColor; int _borderStyle; float _minimumFontSize; id _delegate; UIImage *_background; UIImage *_disabledBackground; int _clearButtonMode; UIView *_leftView; int _leftViewMode; UIView *_rightView; int _rightViewMode; UITextInputTraits *_traits; UITextInputTraits *_nonAtomTraits; float _fullFontSize; float _paddingLeft; float _paddingTop; float _paddingRight; float _paddingBottom; NSString *_textFont; struct _NSRange _selectionRange; int _scrollXOffset; int _scrollYOffset; float _progress; NSString *_style; UIButton *_clearButton; struct CGSize _clearButtonOffset; struct CGSize _leftViewOffset; struct CGSize _rightViewOffset; UITextFieldBorderView *_backgroundView; UITextFieldBorderView *_disabledBackgroundView; UITextFieldBackgroundView *_systemBackgroundView; UITextFieldLabel *_textLabel; UITextFieldLabel *_placeholderLabel; UITextFieldLabel *_suffixLabel; UITextFieldLabel *_prefixLabel; UIImageView *_iconView; UILabel *_label; float _labelOffset; UITextInteractionAssistant *_interactionAssistant; UIView *_inputView; UIView *_inputAccessoryView; UITextFieldAtomBackgroundView *_atomBackgroundView; UIColor *_shadowColor; struct CGSize _shadowOffset; float _shadowBlur; struct { unsigned int secureTextChanged:1; unsigned int guard:1; unsigned int delegateRespondsToHandleKeyDown:1; unsigned int verticallyCenterText:1; unsigned int isAnimating:4; unsigned int inactiveHasDimAppearance:1; unsigned int becomesFirstResponderOnClearButtonTap:1; unsigned int clearsOnBeginEditing:1; unsigned int clearsPlaceholderOnBeginEditing:1; unsigned int adjustsFontSizeToFitWidth:1; unsigned int fieldEditorAttached:1; unsigned int canBecomeFirstResponder:1; unsigned int shouldSuppressShouldBeginEditing:1; unsigned int inResignFirstResponder:1; unsigned int undoDisabled:1; unsigned int contentsRTL:1; unsigned int explicitAlignment:1; unsigned int implementsCustomDrawing:1; unsigned int needsClearing:1; unsigned int suppressContentChangedNotification:1; unsigned int allowsEditingTextAttributes:1; unsigned int usesAttributedText:1; unsigned int backgroundViewState:2; unsigned int clearsOnInsertion:1; } _textFieldFlags; _UITextServiceSession *_definitionSession; _UITextServiceSession *_learnSession; BOOL _deferringBecomeFirstResponder; BOOL _avoidBecomeFirstResponder; BOOL _setSelectionRangeAfterFieldEditorIsAttached; NSArray *_baselineLayoutConstraints; _UIBaselineLayoutStrut *_baselineLayoutLabel; } @property(retain) UIView *inputView; // @synthesize inputView=_inputView; @property(nonatomic) int rightViewMode; // @synthesize rightViewMode=_rightViewMode; @property(retain, nonatomic) UIView *rightView; // @synthesize rightView=_rightView; @property(nonatomic) int leftViewMode; // @synthesize leftViewMode=_leftViewMode; @property(retain, nonatomic) UIView *leftView; // @synthesize leftView=_leftView; @property(nonatomic) int clearButtonMode; // @synthesize clearButtonMode=_clearButtonMode; @property(retain, nonatomic) UIImage *disabledBackground; // @synthesize disabledBackground=_disabledBackground; @property(retain, nonatomic) UIImage *background; // @synthesize background=_background; @property(nonatomic) id delegate; // @synthesize delegate=_delegate; @property(nonatomic) float minimumFontSize; // @synthesize minimumFontSize=_minimumFontSize; @property(nonatomic) int borderStyle; // @synthesize borderStyle=_borderStyle; @property(retain, nonatomic, setter=_setBaselineLayoutLabel:) _UIBaselineLayoutStrut *_baselineLayoutLabel; // @synthesize _baselineLayoutLabel; @property(copy, nonatomic, setter=_setBaselineLayoutConstraints:) NSArray *_baselineLayoutConstraints; // @synthesize _baselineLayoutConstraints; - (void)setSelectionGranularity:(int)arg1; - (int)selectionGranularity; - (id)_findWebViewWordBoundaryFromPosition:(id)arg1; @property(nonatomic) int selectionAffinity; - (id)characterRangeAtPoint:(struct CGPoint)arg1; - (id)closestPositionToPoint:(struct CGPoint)arg1 withinRange:(id)arg2; - (id)closestPositionToPoint:(struct CGPoint)arg1; - (struct CGRect)caretRectForPosition:(id)arg1; - (struct CGRect)firstRectForRange:(id)arg1; - (void)setBaseWritingDirection:(int)arg1 forRange:(id)arg2; - (int)baseWritingDirectionForPosition:(id)arg1 inDirection:(int)arg2; - (id)characterRangeByExtendingPosition:(id)arg1 inDirection:(int)arg2; - (id)positionWithinRange:(id)arg1 farthestInDirection:(int)arg2; @property(readonly, nonatomic) id tokenizer; @property(nonatomic) id inputDelegate; - (int)offsetFromPosition:(id)arg1 toPosition:(id)arg2; - (int)comparePosition:(id)arg1 toPosition:(id)arg2; - (id)positionFromPosition:(id)arg1 inDirection:(int)arg2 offset:(int)arg3; - (id)positionFromPosition:(id)arg1 offset:(int)arg2; - (id)textRangeFromPosition:(id)arg1 toPosition:(id)arg2; @property(readonly, nonatomic) UITextPosition *endOfDocument; @property(readonly, nonatomic) UITextPosition *beginningOfDocument; - (void)unmarkText; - (void)setMarkedText:(id)arg1 selectedRange:(struct _NSRange)arg2; @property(copy, nonatomic) NSDictionary *markedTextStyle; @property(readonly, nonatomic) UITextRange *markedTextRange; @property(copy) UITextRange *selectedTextRange; - (void)replaceRange:(id)arg1 withText:(id)arg2; - (id)textInRange:(id)arg1; - (BOOL)hasText; - (id)metadataDictionariesForDictationResults; - (struct CGRect)frameForDictationResultPlaceholder:(id)arg1; - (void)removeDictationResultPlaceholder:(id)arg1 willInsertResult:(BOOL)arg2; - (id)insertDictationResultPlaceholder; - (void)insertDictationResult:(id)arg1 withCorrectionIdentifier:(id)arg2; - (void)insertText:(id)arg1; - (void)deleteBackward; - (id)_proxyTextInput; - (BOOL)canPerformAction:(SEL)arg1 withSender:(id)arg2; - (BOOL)inPopover; - (void)_promptForReplace:(id)arg1; - (void)replace:(id)arg1; - (void)_showTextStyleOptions:(id)arg1; - (void)toggleUnderline:(id)arg1; - (void)toggleItalics:(id)arg1; - (void)toggleBoldface:(id)arg1; - (void)makeTextWritingDirectionLeftToRight:(id)arg1; - (void)makeTextWritingDirectionRightToLeft:(id)arg1; - (void)selectAll:(id)arg1; - (void)select:(id)arg1; - (void)paste:(id)arg1; - (void)_addShortcut:(id)arg1; - (void)_selectionMayChange:(id)arg1; - (BOOL)_isDisplayingReferenceLibraryViewController; - (void)_define:(id)arg1; - (void)copy:(id)arg1; - (void)cut:(id)arg1; - (id)webView; - (struct CGPoint)constrainedPoint:(struct CGPoint)arg1; - (unsigned int)offsetInMarkedTextForSelection:(id)arg1; - (struct CGRect)closestCaretRectInMarkedTextRangeForPoint:(struct CGPoint)arg1; - (id)selectedAttributedText; - (id)selectedText; - (id)selectionRectsForRange:(id)arg1; - (struct CGRect)_selectionClipRect; - (id)interactionAssistant; - (id)selectionView; - (void)cancelAutoscroll; - (void)startAutoscroll:(struct CGPoint)arg1; - (BOOL)hasSelection; - (id)_fieldEditor; - (void)endSelectionChange; - (void)beginSelectionChange; - (BOOL)isEditable; - (id)undoManager; - (int)atomStyle; - (void)setAtomStyle:(int)arg1; - (BOOL)drawsAsAtom; - (void)setDrawsAsAtom:(BOOL)arg1; - (void)setClearButtonOffset:(struct CGSize)arg1; - (void)_clearButtonClicked:(id)arg1; - (BOOL)isUndoEnabled; - (void)setUndoEnabled:(BOOL)arg1; - (void)setTextCentersVertically:(BOOL)arg1; - (void)setTextCentersHorizontally:(BOOL)arg1; - (void)setLabel:(id)arg1; - (id)textLabel; - (void)setLabelOffset:(float)arg1; - (BOOL)hasMarkedText; - (void)setProgress:(float)arg1; - (struct CGRect)iconRect; - (void)setBecomesFirstResponderOnClearButtonTap:(BOOL)arg1; - (struct CGSize)clearButtonOffset; - (void)setIcon:(id)arg1; - (unsigned int)characterOffsetAtPoint:(struct CGPoint)arg1; - (void)setSelectionRange:(struct _NSRange)arg1; - (struct _NSRange)selectionRange; - (void)clearText; - (void)layoutTilesNow; - (void)_resetSelectionUI; - (void)_clearSelectionUI; - (void)selectAll; - (void)setEnabled:(BOOL)arg1; - (void)_setEnabled:(BOOL)arg1 animated:(BOOL)arg2; - (void)setInactiveHasDimAppearance:(BOOL)arg1; - (void)setTextFont:(id)arg1; - (float)paddingRight; - (void)setPaddingRight:(float)arg1; - (float)paddingBottom; - (void)setPaddingBottom:(float)arg1; - (float)paddingTop; - (void)setPaddingTop:(float)arg1; - (float)paddingLeft; - (void)setPaddingLeft:(float)arg1; - (void)setPaddingTop:(float)arg1 paddingLeft:(float)arg2; - (void)drawBorder:(struct CGRect)arg1; - (void)drawRect:(struct CGRect)arg1; - (BOOL)_canDrawContent; - (BOOL)_implementsCustomDrawing; - (struct CGRect)editRect; - (struct CGRect)textRect; - (struct CGRect)clearButtonRect; - (void)setClearButtonStyle:(int)arg1; - (void)setTextAutorresizesToFit:(BOOL)arg1; - (void)setAutoresizesTextToFit:(BOOL)arg1; - (id)documentFragmentForPasteboardItemAtIndex:(int)arg1; - (id)_dictationInterpretations; - (id)supportedPasteboardTypesForCurrentSelection; - (BOOL)fieldEditor:(id)arg1 shouldReplaceWithText:(id)arg2; - (BOOL)fieldEditor:(id)arg1 shouldInsertText:(id)arg2 replacingRange:(struct _NSRange)arg3; - (void)fieldEditorDidChangeSelection:(id)arg1; - (struct _NSRange)fieldEditor:(id)arg1 willChangeSelectionFromCharacterRange:(struct _NSRange)arg2 toCharacterRange:(struct _NSRange)arg3; - (void)selectAllFromFieldEditor:(id)arg1; - (void)fieldEditorDidChange:(id)arg1; - (id)customOverlayContainer; - (void)keyboardInputChangedSelection:(id)arg1; - (BOOL)keyboardInputChanged:(id)arg1; - (BOOL)keyboardInputShouldDelete:(id)arg1; - (BOOL)keyboardInput:(id)arg1 shouldReplaceTextInRange:(struct _NSRange)arg2 replacementText:(id)arg3; - (BOOL)keyboardInput:(id)arg1 shouldInsertText:(id)arg2 isMarkedText:(BOOL)arg3; - (void)_applicationResuming:(id)arg1; - (void)willDetachFieldEditor:(id)arg1; - (void)attachFieldEditor:(id)arg1; - (void)willAttachFieldEditor:(id)arg1; - (void)_drawTextInRect:(struct CGRect)arg1 forLabel:(id)arg2; - (void)drawPrefixInRect:(struct CGRect)arg1; - (void)drawSuffixInRect:(struct CGRect)arg1; - (void)drawPlaceholderInRect:(struct CGRect)arg1; - (void)drawTextInRect:(struct CGRect)arg1; - (struct CGRect)rightViewRectForBounds:(struct CGRect)arg1; - (struct CGRect)leftViewRectForBounds:(struct CGRect)arg1; - (struct CGRect)_baselineLeftViewRectForBounds:(struct CGRect)arg1; - (struct CGRect)clearButtonRectForBounds:(struct CGRect)arg1; - (struct CGRect)editingRectForBounds:(struct CGRect)arg1; - (struct CGRect)placeholderRectForBounds:(struct CGRect)arg1; - (struct CGRect)textRectForBounds:(struct CGRect)arg1; - (struct CGRect)borderRectForBounds:(struct CGRect)arg1; @property(retain) UIView *inputAccessoryView; @property(readonly, nonatomic, getter=isEditing) BOOL editing; - (id)backgroundColor; - (void)setBackgroundColor:(id)arg1; @property(copy, nonatomic) NSDictionary *typingAttributes; @property(nonatomic) BOOL allowsEditingTextAttributes; @property(nonatomic) BOOL adjustsFontSizeToFitWidth; - (void)setClearsPlaceholderOnBeginEditing:(BOOL)arg1; - (BOOL)clearsPlaceholderOnBeginEditing; @property(nonatomic) BOOL clearsOnBeginEditing; - (void)_setPrefix:(id)arg1; - (void)_setSuffix:(id)arg1 withColor:(id)arg2; @property(copy, nonatomic) NSAttributedString *attributedPlaceholder; @property(copy, nonatomic) NSString *placeholder; - (void)createPlaceholderIfNecessary; - (void)finishedSettingPlaceholder; - (id)createTextLabelWithTextColor:(id)arg1; - (void)_createBaselineLayoutLabelIfNecessary; - (id)createPlaceholderLabelWithFont:(id)arg1 andTextAlignment:(int)arg2; - (void)setContentVerticalAlignment:(int)arg1; @property(nonatomic) int textAlignment; @property(retain, nonatomic) UIFont *font; - (void)disableClearsOnInsertion; @property(nonatomic) BOOL clearsOnInsertion; - (float)shadowBlur; - (void)setShadowBlur:(float)arg1; - (struct CGSize)shadowOffset; - (void)setShadowOffset:(struct CGSize)arg1; - (id)shadowColor; - (void)setShadowColor:(id)arg1; @property(retain, nonatomic) UIColor *textColor; - (void)_updateTextColor; @property(copy, nonatomic) NSAttributedString *attributedText; - (void)_setAttributedText:(id)arg1 onFieldEditorAndSetCaretSelectionAfterText:(BOOL)arg2; - (void)_transferTextFieldPropertiesFromText:(id)arg1; - (void)_transferAttribute:(id)arg1 fromString:(id)arg2 andSetPropertyWith:(SEL)arg3 usingValueClass:(Class)arg4; @property(copy, nonatomic) NSString *text; - (void)finishedSettingTextOrAttributedText; - (id)searchText; - (BOOL)_hasContent; - (id)_attributedText; - (id)_text; @property(nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry; // @dynamic secureTextEntry; - (void)_updateTextLabel; - (BOOL)respondsToSelector:(SEL)arg1; - (id)methodSignatureForSelector:(SEL)arg1; - (void)forwardInvocation:(id)arg1; - (id)textInputTraits; - (BOOL)_shouldSendContentChangedNotificationsIfOnlyMarkedTextChanged; - (id)_textLabelView; - (id)_placeholderLabel; - (id)_placeholderView; - (id)_placeholderColor; - (void)_setSystemBackgroundViewActive:(BOOL)arg1; - (BOOL)_fieldEditorAttached; - (Class)_systemBackgroundViewClass; - (void)_setRightViewOffset:(struct CGSize)arg1; - (struct CGSize)_rightViewOffset; - (void)_setLeftViewOffset:(struct CGSize)arg1; - (struct CGSize)_leftViewOffset; - (struct CGPoint)_scrollOffset; - (id)actualFont; - (float)actualMinimumFontSize; - (struct CGRect)adjustedCaretRectForCaretRect:(struct CGRect)arg1; - (void)_updateRTLStateForText:(id)arg1 updateAlignment:(BOOL)arg2; - (void)_setImplicitAlignment; - (void)_clearBackgroundViews; - (void)_updateBackgroundViewsAnimated:(BOOL)arg1; - (BOOL)_shouldEndEditing; - (void)layoutSubviews; - (struct CGRect)_prefixFrame; - (struct CGRect)_suffixFrame; - (void)updateConstraints; - (void)_setUpBaselineLayoutConstraints; - (struct CGRect)_frameForLabel:(id)arg1 inTextRect:(struct CGRect)arg2; - (void)_updateLabel; - (struct CGRect)_textRectExcludingButtonsForBounds:(struct CGRect)arg1; - (struct CGRect)_textRectForBounds:(struct CGRect)arg1 forEditing:(BOOL)arg2; - (BOOL)_isShowingPrefix; - (BOOL)_isShowingPlaceholder; - (BOOL)_showsRightView; - (BOOL)_showsLeftView; - (BOOL)_showsClearButtonWhenEmpty; - (BOOL)_showsClearButton:(BOOL)arg1; - (BOOL)_showsClearButtonWhenNonEmpty:(BOOL)arg1; - (void)_updateAtomBackground; - (BOOL)_showsAtomBackground; - (BOOL)_partsShouldBeMini; - (BOOL)_heightShouldBeMini; - (struct CGRect)_atomBackgroundViewFrame; - (void)_updateAutosizeStyleIfNeeded; - (void)_updateButtons; - (id)_clearButton; - (id)clearButton; - (id)_clearButtonImageForState:(unsigned int)arg1; - (void)_endedEditing; - (id)_style; - (id)_createCSSStyleDeclarationForWebView:(id)arg1; - (float)_marginTop; - (id)_copyFont:(id)arg1 newSize:(float)arg2 maxSize:(float)arg3; - (void)setFont:(id)arg1 fullFontSize:(float)arg2; - (id)hitTest:(struct CGPoint)arg1 withEvent:(id)arg2; - (void)touchesEnded:(id)arg1 withEvent:(id)arg2; - (void)touchesCancelled:(id)arg1 withEvent:(id)arg2; - (void)_resignFirstResponder; - (void)_windowBecameKey; - (BOOL)resignFirstResponder; - (void)_removeShortcutController; - (void)_removeDefinitionController; - (void)_becomeFirstResponder; - (void)_updatePlaceholderPosition; - (int)_currentTextAlignment; - (void)__resumeBecomeFirstResponder; - (void)_becomeFirstResponderAndMakeVisible; - (BOOL)_requiresKeyboardResetOnReload; - (id)_keyboardResponder; - (BOOL)canResignFirstResponder; - (BOOL)canBecomeFirstResponder; - (struct CGSize)sizeThatFits:(struct CGSize)arg1; - (struct CGSize)_intrinsicSizeWithinSize:(struct CGSize)arg1; - (id)viewForBaselineLayout; - (struct CGSize)_textSize; - (struct CGSize)_textSizeUsingFullFontSize:(BOOL)arg1; - (void)setAnimating:(BOOL)arg1; - (void)setBounds:(struct CGRect)arg1; - (void)setFrame:(struct CGRect)arg1; - (void)_sizeChanged:(BOOL)arg1; - (void)_setNeedsStyleRecalc; - (void)_clearStyle; - (void)dealloc; - (void)_encodeBackgroundColorWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (void)_populateArchivedSubviews:(id)arg1; - (id)initWithCoder:(id)arg1; - (id)initWithFrame:(struct CGRect)arg1; - (void)_invalidateBaselineLayoutConstraints; - (id)_scriptingInfo; - (void)decodeRestorableStateWithCoder:(id)arg1; - (void)encodeRestorableStateWithCoder:(id)arg1; - (BOOL)isElementAccessibilityExposedToInterfaceBuilder; - (BOOL)isAccessibilityElementByDefault; // Remaining properties @property(nonatomic) int autocapitalizationType; // @dynamic autocapitalizationType; @property(nonatomic) int autocorrectionType; // @dynamic autocorrectionType; @property(nonatomic) BOOL enablesReturnKeyAutomatically; // @dynamic enablesReturnKeyAutomatically; @property(nonatomic) int keyboardAppearance; // @dynamic keyboardAppearance; @property(nonatomic) int keyboardType; // @dynamic keyboardType; @property(nonatomic) int returnKeyType; // @dynamic returnKeyType; @property(nonatomic) int spellCheckingType; // @dynamic spellCheckingType; @property(readonly, nonatomic) UIView *textInputView; @end


首先我们看它声明的方法,关于cursor 的函数,或者表示类似颜色设置的函数,一看之下,没有。这个时候我们注意到有一个函数是 - (id)textInputTraits;

字面意思上是文本输入特征的意思,这个很有可能是我们需要的设置光标的颜色,ok,现在我们开始写代码。

省略创建project的步骤,直接上代码




我们看到private 下面,有一行是标识color的,很可能这个就是我们找的光标样色的属性。同样我们看一下 UITextfieldTraits的头文件,找到我们需要调用的函数。

 

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#import "NSObject.h" #import "NSCopying.h" #import "UITextInputTraits.h" #import "UITextInputTraits_Private.h" @class UIColor, UIImage; @interface UITextInputTraits : NSObject { int autocapitalizationType; int autocorrectionType; int spellCheckingType; unsigned int keyboardType:8; unsigned int keyboardAppearance:8; int returnKeyType; BOOL enablesReturnKeyAutomatically; BOOL secureTextEntry; struct __CFCharacterSet *textTrimmingSet; UIColor *insertionPointColor; UIColor *selectionBarColor; UIColor *selectionHighlightColor; UIImage *selectionDragDotImage; unsigned int insertionPointWidth; int textLoupeVisibility; int textSelectionBehavior; id textSuggestionDelegate; BOOL contentsIsSingleValue; BOOL acceptsEmoji; BOOL returnKeyGoesToNextResponder; BOOL acceptsFloatingKeyboard; BOOL acceptsSplitKeyboard; BOOL displaySecureTextUsingPlainText; BOOL learnsCorrections; int emptyContentReturnKeyType; int shortcutConversionType; BOOL suppressReturnKeyStyling; BOOL forceEnableDictation; BOOL useInterfaceLanguageForLocalization; BOOL deferBecomingResponder; } + (BOOL)keyboardTypeRequiresASCIICapable:(int)arg1; + (id)traitsByAdoptingTraits:(id)arg1; + (id)defaultTextInputTraits; @property(nonatomic) BOOL deferBecomingResponder; // @synthesize deferBecomingResponder; @property(nonatomic) BOOL useInterfaceLanguageForLocalization; // @synthesize useInterfaceLanguageForLocalization; @property(nonatomic) BOOL forceEnableDictation; // @synthesize forceEnableDictation; @property(nonatomic) BOOL suppressReturnKeyStyling; // @synthesize suppressReturnKeyStyling; @property(nonatomic) int shortcutConversionType; // @synthesize shortcutConversionType; @property(nonatomic) BOOL learnsCorrections; // @synthesize learnsCorrections; @property(nonatomic) BOOL displaySecureTextUsingPlainText; // @synthesize displaySecureTextUsingPlainText; @property(nonatomic) BOOL acceptsSplitKeyboard; // @synthesize acceptsSplitKeyboard; @property(nonatomic) BOOL acceptsFloatingKeyboard; // @synthesize acceptsFloatingKeyboard; @property(nonatomic) BOOL returnKeyGoesToNextResponder; // @synthesize returnKeyGoesToNextResponder; @property(nonatomic) int emptyContentReturnKeyType; // @synthesize emptyContentReturnKeyType; @property(nonatomic) BOOL acceptsEmoji; // @synthesize acceptsEmoji; @property(nonatomic) BOOL contentsIsSingleValue; // @synthesize contentsIsSingleValue; @property(nonatomic) int textSelectionBehavior; // @synthesize textSelectionBehavior; @property(nonatomic) int textLoupeVisibility; // @synthesize textLoupeVisibility; @property(nonatomic) unsigned int insertionPointWidth; // @synthesize insertionPointWidth; @property(retain, nonatomic) UIImage *selectionDragDotImage; // @synthesize selectionDragDotImage; @property(retain, nonatomic) UIColor *selectionHighlightColor; // @synthesize selectionHighlightColor; @property(retain, nonatomic) UIColor *selectionBarColor; // @synthesize selectionBarColor; @property(retain, nonatomic) UIColor *insertionPointColor; // @synthesize insertionPointColor; @property(nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry; // @synthesize secureTextEntry; @property(nonatomic) BOOL enablesReturnKeyAutomatically; // @synthesize enablesReturnKeyAutomatically; @property(nonatomic) int returnKeyType; // @synthesize returnKeyType; @property(nonatomic) int keyboardAppearance; // @synthesize keyboardAppearance; @property(nonatomic) int keyboardType; // @synthesize keyboardType; @property(nonatomic) int spellCheckingType; // @synthesize spellCheckingType; @property(nonatomic) int autocorrectionType; // @synthesize autocorrectionType; @property(nonatomic) int autocapitalizationType; // @synthesize autocapitalizationType; - (BOOL)isEqual:(id)arg1; - (id)description; - (id)copyWithZone:(struct _NSZone *)arg1; - (void)takeTraitsFrom:(id)arg1; - (void)setToDefaultValues; - (void)dealloc; - (id)init; @property(nonatomic) id textSuggestionDelegate; // @dynamic textSuggestionDelegate; @property(nonatomic) struct __CFCharacterSet *textTrimmingSet; // @dynamic textTrimmingSet; - (id)dictionaryRepresentation; - (void)setToSecureValues; @end

我们找到一个property : insertionPointColor,字面意思上基本上确定这个就是我们要找的设置光标的函数。

 

经过尝试果然如此,现在贴上结果



各位看官,这次的关于私有api的分析就结束了,其实整个过程没这么顺利,只是我省掉了一些,本身这个做法我也没有用到项目中,而是选择一个开源的项目,但是对于私有ipa的熟悉也体现一个程序员对于apple这套东西的熟悉,同时我们可以模仿私有的实现,做一些事情,但是不推荐大家直接使用私有ipa。

最后

以上就是忧郁摩托最近收集整理的关于ios中经过调试来使用私有ipa的全部内容,更多相关ios中经过调试来使用私有ipa内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部