Iphone textfield display cursor

佐手、 提交于 2020-01-04 04:18:10

问题


i'm developing a calculator for iphone. The design is similar to this:

The problem is that i can't show the cursor in my textField because the input is managed from buttons like the image. Moreover [textField becomeFirstResponder ] doesn't work because it shows the default keyboard.

So i tried to

textResultado.inputView = scrollView;

but then the tabBarController can't receive touch events because my custom keyboard contained in the scroll view is over it.

The caption is from an app in the AppStore so must be a way in order to solve this problem (show the cursor in a TextField using a different inputView and the tabBar still working fine).

Anyone can help me?


回答1:


Create an input view which is invisible and then make textResultado the first responder.

textResultado.inputView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
[textResultado becomeFirstResponder];



回答2:


I discover that using this solution you can have strange flickering of the gui on iPhone 4 with iOS 6.1.3. iPhone 3Gs with iOS 6.1.3 works correctly.

The flicker appears when text area is selected and a dialog window appears. Closing the dialog window causes flickering.



来源:https://stackoverflow.com/questions/6358393/iphone-textfield-display-cursor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!