How can I create some view over UIKeyBoard? - iphone

I fill information then tap "Done" button for doing some process and show loading view for waiting.
I need loading view is over every view, but How can I do?
Thanks for adviser.
Here is my image (I'm new in here, so I can't post image)
http://www.freeimagehosting.net/image.php?62e2584aea.png

You should make your keyboard disappear from the screen as soon as user taps on done button.
call this method
[myTextField resignFirstResponder]
when you start loading

this is the best answer for your question
[textField setInputAccessoryView:inputAccessoryView];

Did you observe the UIKeyboardWillShowNotification and UIKeyboardDidShowNotification notifications? You can update the view elements in the handlers.

Try to add the loading HUDView ro whatever you are using for the purpose on the application's keywindow.
as
[[UIApplication sharedApplication].keyWindow addSubview:loadingView];
ALso resigning the responder while the loadingview is displayed is really a very important thing you should do.
[myTextField resignFirstResponder]

Related

removing keyboard from Screen without calling resignFirstResponder

I have a custom View (NotifyView) added on UIWindow with a dismiss button(which remove it from UIWindow).
This view is added when a PUSH notification comes in didReceiveRemoteNotification
there are several cases when I could be on any screen, and my keyboard is UP via UITextfield/UITextview.
At this stage if a push comes, the NotifyView is added on UIWindow behind the keyboard.
I want to resign the keyboard once the PUSH is received so for that I could:
post a Notification with NSNotificaitonCenter to resign all textfields/textviews (if anyone is firstResponder). For this I have to keep active pointer to the currently active textfield/textview in all controllers.
make a variable in AppDelegate and assign the active textfields/textviews to it and on PUSH, and resignFirstResponder of those on PUSH.
Both of the solutions would require making changes to all controller's code and I am looking for something more generic like:
could there be any way through which I could simply remove the Keyboard from the screen on receiving PUSH
or I could fetch the current firstResponder of the application and resign it explicitly.
these could be generic solutions.
It would be really helpful if someone could facilitate this thought process or someone have any immediate solution for this case.
You can use the method below
[[[UIApplication sharedApplication] keyWindow] endEditing:YES]
Try this one , for me it works fine
[yourView endEditing:YES]
The problem it is, when you want to give back the focus.
I have implemented as listening each textfield and caching which is the latest. Than resign only that one ( in push ) after that restore state, require focus for that.
Try this in delegate method...
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
[self.view endEditing:YES]; // added this in for case when keyboard was already on screen
[self editStartDate:textField];
return NO;
}

Button touchupinside action done automatically on view appear?

I want Button action done automatically when a view load. Is it possible?
The other answers are correct in that setting the action that your button is tied to, then in your viewDidLoad:, call that function will work. I will just chime in with another method for others info.
You can send it a control event telling it that the button should act as if it has been pressed:
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
This is useful when you do not have an outlet to the button. For instance, I created an app where the user can press on a web view and launch a youtube video. It was also required that if the user presses a "video" button, then the same youtube video would launch. Basically, I had to fire a press event on the web view. So i searched through its views and found the button, from there I called the above line, and the webview pushes a video view controller for the youtube video.
Certainly Yes. Call your method as
assuming your method declaration as
-(IBAction)yourButtonTapEvent:(id)sender;
[self yourButtonTapEvent:nil];
Yes, in your viewDidAppear method, just call the action you are providing for that specific button.
- (void)viewDidAppear:(BOOL)animated
{
[self yourButtonAction:nil];
[super viewDidAppear:animated];
}

resignFirstResponder and close keyboard from anywhere?

I have a situation where the keyboard maybe open and then an NSTimer pops a view over the text view. Is there anyway to close the keyboard globally rather than from the text view resignFirstResponder method? The reason I ask is that the textView is dynamic in that it maybe there sometimes and not others. One way would be to give it a TAG. Can multiple items be referenced with same tag?
I think the answer is no but I would be interested in your thoughts?
Thanks
Steve
To dismiss the keyboard from anywhere, even if you don't know directly who is the firstResponder, use:
[[[[UIApplication sharedApplication] delegate] window] endEditing:YES];
The endEditing: method of UIView should do the trick. Send it to the superview of the potentially existing UITextView when you want to dismiss the keyboard.
You can try to send some control the message becomeFirstResponder
You could pass a reference to the UITextView in the NSTimer...
ORRRRR....
In the view that pops up you could do something like:
for(id view in self.superview.subviews){
[(UIView *)view resignFirstResponder];
}

Unhide the keyboard in iphone

In my application what is want is when user clicks on button next view is pushed and default keyboard should be open in the pushed view .
Thanks in advance
You'll have to use -becomeFirstResponder: in the -viewDidAppear: method.
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[yourTextField becomeFirstResponder];
}
This will make the keyboard appear.
Assuming you have a text field or something in that view you need to do this:
[myTextView becomeFirstResponder] in your viewDidLoad method.
in your next view, call the becomeFirstResponder method from the input field.
e.g. [[nextViewController] usernameField] becomeFirstResponder];

UIActivityindicator won't be displayed upon Modalviewcontroller

i've created a login screen via a modalviewcontroller. But certainly i have a problem to display a uiactivityindicator once the loginbutton was pressed.
Instead the activityindicator seem to be displayed for a minimal period of time, when releasing the modalviewcontroller.
Does anyone know the problem.
Could anybody help me out?
Thanks a lot.
Greetz
I've got the solution.
Apple seems to combine animations. So the animation of dismissng the modalview and startanimating function of the uiactivityindicator are combined to one action
and the animation of the activityindicator will be never shown.
Simple hack:
Just wait with the dismissal of the modalview for a short time e.g.
[self performSelector:#selector(hideLogin) withObject:nil afterDelay:0.1];