开发者

iPhone Keyboard Shift state: how to control it?

开发者 https://www.devze.com 2022-12-11 05:28 出处:网络
Sorry if my question if a dumb one, but I couldn\'t find a way to solve it. The thing is a have a custom text view that sometimes need to wrap text according to its own rules. Everything works just fi

Sorry if my question if a dumb one, but I couldn't find a way to solve it. The thing is a have a custom text view that sometimes need to wrap text according to its own rules. Everything works just fine with static content, but if I insert a @"\n" as the user starts to write another word (I know the word he's going to type and I know it won't fit anyway), iPhone keyboard automatically toggles shift on, which drives the user mad as he didn't intend to capitalize the word. It's mission critical for me to have those wraps working, so I either need a way to end line in another way or toggle shift on keyboard back.

Or, in two words: how can I toggle keyboard's shift off programmatically?

Anybody?

UPDATE Guys, a small question around the keyboard on iPhone. AFAIK we can get keyboard's object (by fetching UIKeyboardImpl class and calling +sharedInstance on it) and obviously do some things around it. However, I also heard that Apple is very concerned around such hack, so I'm curious if they could reject the app if I fix the issue using such approach? Obviously, I'm not going to change kayboard outlook, and even logic remains the same (at least from human's point of view), but is this enough to not get ass-kicked?

UPDATE 2 For now I managed to achieve the desired behavior by turning autocap off and setting shi开发者_如何学JAVAft state manually. Is there a better solution?


There is no way to toggle the shift manually on the keyboard (at least not without using some undiscovered private API), but you can control the Autocapitalization behavior of the textfield by saying [myTextField setAutocapitalizationType:UITextAutocapitalizationTypeNone];

0

精彩评论

暂无评论...
验证码 换一张
取 消