Google을 통한 나의 긴 검색 이후에 비슷한 문제를 발견하지 못했습니다. 일부는 가까이에 왔지만 내 것과는 달랐습니다.멀티 태스킹 할 때 툴바가 움직입니다.
손에 넣기 : 내 앱 (WKWebView 기반)에서 키보드가 표시되고 집을 두 번 탭한 다음 키보드가 표시된 다른 앱으로 전환하면 내 앱 키보드가 숨겨집니다. 별일 아니다. 그래서 내가 다시 멀티 태스킹을하면, 내 애플 리케이션의 스냅 샷에서 키보드가 사라졌지만 위의 사용자 정의 툴바는 키보드가없는 상태로 남아있는 것처럼 보였다. 나는 내 애플 리케이션을 살짝 누른 다음 애니메이션의 화면을 아래로 다시 애니메이션.
내가 시도한 것 : [self.view endEditing : YES], resigningFirstResponder 및 모든 키보드 닫기 방법에 대해 알고 있습니다. viewWillDisappear, applicationWillResignActive 및 applicationDidEnterBackground를 통해 배치 및 혼합을 시도했습니다. 어느 것도 내 도구 모음 문제를 처리하지 않습니다.
이렇게하면 툴바를 보이게하면서 키보드를 움직이면서 화면을 켜거나 끌 수 있습니다.
- (void)keyboardWillShow:(NSNotification*)notification
{
NSDictionary* info = [notification userInfo];
NSNumber *durationValue = info[UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curveValue = info[UIKeyboardAnimationCurveUserInfoKey];
NSValue *endFrame = info[UIKeyboardFrameEndUserInfoKey];
[UIView animateWithDuration:durationValue.doubleValue
delay:0
options:(curveValue.intValue << 16)
animations:^{
self.toolBar.frame = CGRectMake(0,
[endFrame CGRectValue].origin.y - self.toolBar.bounds.size.height+44,
self.toolBar.bounds.size.width,
self.toolBar.bounds.size.height);
}
completion:nil];
}
- (void)keyboardWillHide:(NSNotification*)notification
{
NSDictionary* info = [notification userInfo];
NSNumber *durationValue = info[UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curveValue = info[UIKeyboardAnimationCurveUserInfoKey];
NSValue *endFrame = info[UIKeyboardFrameEndUserInfoKey];
[UIView animateWithDuration:durationValue.doubleValue
delay:0
options:(curveValue.intValue << 16)
animations:^{
self.toolBar.frame = CGRectMake(0,
[endFrame CGRectValue].origin.y - self.toolBar.bounds.size.height,
self.toolBar.bounds.size.width,
self.toolBar.bounds.size.height);
}
completion:nil];
}
아무도 실마리가 없습니까?
다시 말하지만 내 앱은 WKWebView 기반이므로 직접 호출하거나 textviews로 향하고 webview에 집중하려고하면 무의미합니다.
누군가 더 많은 코드가 필요하면 알려주세요. 도움이 될 것입니다. 고맙습니다.
그래서 여기
1/20/18 업데이트 내 도구 모음이 초기화되고로드되는 곳에 어떻게 관련 요청 된 코드입니다.
h.
UIToolbar *toolBar;
@property (nonatomic, strong) UIToolbar *toolBar;
m. 그것에 관하여
@synthesize toolBar;
- (void)viewDidLoad {
//Toolbar setup
CGRect toolFrame, remain;
CGRectDivide(self.view.bounds, &toolFrame, &remain, 48, CGRectMaxYEdge);
self.toolBar = [[UIToolbar alloc] initWithFrame:toolFrame];
[self.toolBar setBarStyle:UIBarStyleBlackTranslucent];
[self.toolBar setClipsToBounds:YES];
[self.toolBar setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
[self.view addSubview:self.toolBar];
}
는, 다른 하나는 그때 버튼을 전환 할 때 새로 고침을 호출하는 코드는, 아무 것도이 도구 모음에 연결되지 않습니다.
사용자가 배경을 변경할 때 스위치를 누르거나 새로 고치지 않으면이 뷰가 호출되지 않습니다. NSUserDefaults를 다른 뷰에서 처리하십시오.
-(void)viewWillLayoutSubviews{
[self.currentScrollView layoutIfNeeded];
[self.toolBar layoutIfNeeded];
[self.view layoutSubviews];
}
이것은 여전히 내 앱에서 계속 발생하는 문제입니다. – ChrisOSX
도구 모음을 어디에서 만들었습니까? – ChikabuZ
앱이로드되면 내 기본보기 (viewDidLoad)에 만들어집니다. 나는 그것을 h 파일에 속성으로 만든 다음 m 파일에서 합성하고 subView에 추가했습니다. – ChrisOSX