ios - UIActivityIndicatorView displayed beneath the keyboard -
inside static library (lib.a), have navigationcontroller in storyboard initiate after button tap with:
[mainwindow.rootviewcontroller presentviewcontroller:newcontroller animated:no completion:nil]; within newcontroller have uitextfield set becomefirstresponder upon viewdidload , button when tapped want display uialertview after pressing "ok" should show uiactivityindicatorview on top of (including keyboard).
the code using display uiactivityindicatorview next
uiwindow *mainwindow = [[uiapplication sharedapplication] keywindow]; spinner = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylewhite]; spinner.autoresizingmask = (uiviewautoresizingflexibleleftmargin | uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexibletopmargin | uiviewautoresizingflexiblebottommargin); spinner.center = cgpointmake(cgrectgetwidth(mainwindow.bounds)/2, cgrectgetheight(mainwindow.bounds)/2); spinner.frame = mainwindow.bounds; spinner.backgroundcolor = [uicolor darkgraycolor]; spinner.alpha = 0.7f; [mainwindow addsubview:spinner]; and whenever user taps on button execute following:
uialertview *message = [[uialertview alloc] initwithtitle:@"confirmation" message:@"are sure?" delegate:self cancelbuttontitle:@"no" otherbuttontitles:@"yes", nil]; [message show]; and when tapped have simple method that:
//initializing spinner [spinner startanimating]; //execute nsurl connection.... the problem uiactivityindicatorview not show on top of keyboard.
any ideas?
try add together after
[mainwindow addsubview:spinner]; something like
[mainwindow bringsubviewtofront:spinner]; try utilize view superview uiactivityindicatorview
- (uiview *)keyboardview { nsarray *windows = [[uiapplicatio sharedapplication] windows]; (uiwindow *window in [windows reverseobjectenumerator]) { (uiview *view in [window subviews]) { if (!strcmp(object_getclassname(view), "uikeyboard")) { homecoming view; } } } homecoming nil; } ios objective-c uialertview uiactivityindicatorview
No comments:
Post a Comment