0

I need to place custom keypad.

For that, I need to disable my default iPhone keypad.

For that I use:

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
   return NO;

}

If I use this the cursor isn't visible.

So, I don't find which textfield is selected.

I need functionality so that my keypad is the same as the default keypad.

Can anyone help me.

Thank you in advance.

Artemis
  • 2,553
  • 7
  • 21
  • 36
Mahesh Babu
  • 3,395
  • 9
  • 48
  • 97

3 Answers3

3

if your app is going to be iOS 3.2+, check out the inputView property of your text view. That can point to a view that replaces your keyboard.

ZaBlanc
  • 4,679
  • 1
  • 35
  • 38
-1

For TextView use this

 - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{


        return NO;
    }

and for TextField use this

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
   return NO;

}
Sabby
  • 2,586
  • 2
  • 27
  • 41
  • Your right But if i use this textfield did n't show curser,then how can i identify which text field is selected – Mahesh Babu Jan 05 '11 at 06:43
  • 1
    Why do you want to hide the keypad,only if you want to show some data in this which would be coming from somewhere.You need to do some logic implementaion well what would i do at this moment,simply put the button (custom button)over the text field and when you would click that button you would get to know which text field was that as the button would be over the textfield and it won't hide your textfield data it would be shown.Also try to give the tag for your textfileds which would also make your implementaion more easy.And don't forget to accept the answer if it helps you and vote up. – Sabby Jan 05 '11 at 07:26
  • ya i am trying this i place the button over textfield in that button click i write [textfield resignFirstResponder]; Keyboard hide but text field does n't get focus.I know which textfield selected but how can i identify user selected textfield. – Mahesh Babu Jan 05 '11 at 07:50
  • You can do it in your viewdidload. No need for a button. Simply use the textfield object. – Swastik Jan 05 '11 at 08:02
  • - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { return NO; } & in viewdidload make it as first responder – Swastik Jan 05 '11 at 08:03
  • 1
    @Swastik how would you get the focus on the textfield,at the time you click the text field its delegate method would be called - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField .And you are telling him to make textfield first responder in the viewDidLoad which is called only once when the view will be loaded,but what about the delegate method of the textfield which is called every time you start to edit the textfield.So better to give better answer and firstly implement yourself.I have done your way,doesn;t work.And think before votedown got it.......and read the ques. first – Sabby Jan 05 '11 at 09:09
  • I am not saying you to try in my way you are not forced to do that,but eventually i would like to tell you that don't criticize anyone, either by voting down or else.you did the vote down for me.And more over when you put an answer,try to do work on that before uploading.Thanks dear and enjoy – Sabby Jan 05 '11 at 10:40
  • @sabby why are you behaving so rude, i didnt downvoted anything.we both are not seeing what actually he is doing in code, we can just suggest.Thanx for your advice, but you are also doing the same what u told @Mahesh (criticing).Your answer is more like the one in the link i posted.so also read the question better to give better answer – Swastik Jan 05 '11 at 11:11
  • @Sabby please keep your rude behavior with you, its not the place to fight instead helping each other. – Swastik Jan 05 '11 at 11:13
  • @Sabby one more advice, please go through earlier answers before answering.My link already had the same solution what you answered.hehee – Swastik Jan 05 '11 at 11:16
  • He he i know ,i also gave him the same option but for both.I am not bothered about the answer i was concerned about the comments,so there is no point to laugh at me...hey hey......Enjoy dude – Sabby Jan 05 '11 at 11:20
  • I am not rude neither with the discussion nor with you.Well apologies I thought that you voted me down.Now will look forward for his problem – Sabby Jan 05 '11 at 11:22
  • @sabby @Swastik please don't fight... take it cool if both u guys combined for the solution it is not a big issue to resolve. please discuss regarding solution – Mahesh Babu Jan 05 '11 at 11:36
  • if u find any solution pls help me. – Mahesh Babu Jan 05 '11 at 12:30
-2

How to hide keyboard once UITextView becomes the first responder in iPhone SDK?

Hope it helps.

Community
  • 1
  • 1
Swastik
  • 2,415
  • 2
  • 31
  • 61
  • Please add comment before downvoting any answer.It helps to correct our answer – Swastik Jan 05 '11 at 07:54
  • if i use the code in the link u posted it disable textfield curser. then how can i show user that he selected textfield.I need to disable only keypad. – Mahesh Babu Jan 05 '11 at 07:56
  • You can use my code & make the textfield you waant the focus as firstResponder.This way there will be no keyboard visible & only your cursor will blink.k.try it out, it works – Swastik Jan 05 '11 at 07:59
  • what r u doing can u elaborate. – Swastik Jan 05 '11 at 09:40
  • Hi mahesh, I'm having same problem as yours. Have you solved the problem. Please tell me some suggestions. – iphony Feb 22 '11 at 07:00