3

I tried to make Textview becomeFirstResponder but it fails. It's working fine with same code with iOS SDK 7 Don't know what's wrong with iOS SDK 8.2.

I am also checking canBecomeFirstResponder too. It passes true for this but fails and returns NO for becomeFirstResponder. Here I am doing this on viewWillAppear method and also tried in viewDidAppear Method.

Code

if([txtView canBecomeFirstResponder])
{
    temp = [txtView becomeFirstResponder];
}

Also I have found same issues with others and they have suggested to use like below. But not working in my case with changing delay time too.

[txtView performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0];

Please suggest If I require to change anything as per new iOS SDK releases.

Raptor
  • 53,206
  • 45
  • 230
  • 366
Niks
  • 647
  • 5
  • 16
  • it does not relate to Xcode; relates to iOS SDK instead. – Raptor Mar 27 '15 at 06:25
  • Just check if you have set the Delegate of txtView and IBOutlet is linked properly from XIB or Storyboard. – Suraj Mirajkar Mar 27 '15 at 06:30
  • @Raptor Okay thanks for update. But I have added because in iOS8 also it's working fine my app store version and it was submitted with xcode 5.X – Niks Mar 27 '15 at 06:33
  • @SurajMirajkar Yes. It's delegate and IBOutlate linked properly I checked for that. Also it's working with iOS7. – Niks Mar 27 '15 at 06:34
  • Try checking if you've implemented `textViewShouldBeginEditing:(UITextView *)textView` delegate that may prevent `textView` to become first responder – Zahid Mar 27 '15 at 06:38
  • What is the issue you are facing. Is the keyboard not appearing in simulator. – Jassi Mar 27 '15 at 07:47
  • @Jassi. Yes keyboard not appearing in simulator as well as in Device. And as stated in question [txtView becomeFirstResponder]; this returns me NO. – Niks Mar 27 '15 at 09:16
  • It is giving NO to me as well. But I can see the keyboard at my end. you are missing something else. Sometimes on keyboard it is hidden so it can be visible by pressing Command+K. But as you said it is not visible on device. that is weird. – Jassi Mar 27 '15 at 09:33
  • @Jassi. Yes that's why I also wrote for device. Yes it's not showing keyboard too and not firing keyboard delegate method too as it's not opening.. – Niks Mar 27 '15 at 09:38
  • If you can send me your code I can check it better. You can add me on skype. My id is - jasvindersingh_evontech. – Jassi Mar 27 '15 at 09:49
  • @Jassi Hi.. thanks you very much for your support and you feedback but it against with my company policy :-( :-( – Niks Mar 27 '15 at 11:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/73930/discussion-between-jassi-and-niks). – Jassi Mar 27 '15 at 11:50
  • let us discuss in chat http://chat.stackoverflow.com/rooms/73930/discussion-between-jassi-and-niks – Jassi Mar 27 '15 at 11:51

1 Answers1

-2

i have used [txtView becomeFirstResponder]; inside viewDidLoad. It's working fine for me.

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
Tanuj
  • 531
  • 4
  • 10
  • Did you had issue like above? Means was getting issue only with latest xcode/iOS8.x? – Niks Mar 27 '15 at 06:51
  • nopes, i have used with xCode 6.1 and iOS 8.2 latest. plz explain me this line of code "temp = [txtView becomeFirstResponder];". – Tanuj Mar 27 '15 at 06:55
  • It's BOOL returns that becomeFirstResponder or not but I am getting NO in that variable. – Niks Mar 27 '15 at 07:26