iPad에서 UIModalPresentationFormSheet 사용시 키보드 내리기

아이패드 작업시 그림1과 같은 모달창에서 키보드를 입력해야 하는 경우가 있습니다.
일반적으로 키보드 작업을 하고 취소오케이를 누르면 키보드도 같이 내려가야 합니다.

iOS Simulator Screen shot 2013. 2. 3. 오전 2.09.01
그림1

 

 

어라! 하지만 그림2와 같이 키보드가 내려가지 않았습니다.
어떻게 된 것일까요? 저도 삽질 끝에 알아낸 결과라 기록으로 남겨둡니다.

iOS Simulator Screen shot 2013. 2. 3. 오전 2.10.55
그림2

 

Stackoverflow 에서 검색을 해보았더니 의견이 분분하더군요!
심지어는 애플의 버그라고 하시는 분들도 계셨습니다.
하지만 알고 보니 UIViewController 내에 disablesAutomaticKeyboardDismissal 이라는 메소드의 기본 설정값이 YES 여서 발생하는 문제였습니다.
모달로 열리는 창에 disablesAutomaticKeyboardDismissal 메소드를 오버라이드 하시면 문제는 해결됩니다.

예를 들면, 다음과 같이 모달을 호출한다고 가정합니다.

보시다시피 formsheet의 형태로 모달을 호출하게 되며 키보드를 띄우게 될 경우 어김없이 사라지지 않는 문제가 발생하게 됩니다.
해결방법은 모달로 띄우는 컨트롤러 소스안에 다음과 같이 넣어주세요.

이렇게 키보드를 자동으로 사라지기 비활성화하기에서 return을 NO로 해주면 활성화한다는 말이 되기때문에 모든 것이 정상적으로 작동할 것 입니다.
만약, UINavigationController에 얹어서 모달을 띄우시는 경우 UINavigationController의 SubClass로 하나 생성하셔서 그 안에 위와 같이 넣어주시고 호출하시면 됩니다.

 

 

lilyhammer season 2 release date unannouncedPlenty is going the Texans’ way jordan sale so far. They’re off to a good start. Everyone recognizes the quality by looking at the uniform and its importance. With the NFL jerseys, fans feel as a part of the team and it creates their identity.. The Popularity of the Super BowlThe Super Bowl is different from other sports team championships mainly because all other sports decide their big winners over several games. The Super Bowl is a one day event, cheap authentic jerseys and the Jets proved anything can happen in this one day and one game. It’s a workout where you actually put more pressure on the muscle for a longer period of time. So for instance if you’re on a bench press you’ll take the bar off, you’ll push it up and just hold it for a minute or a little bit longer. On the morning of the game, the Giants president John V. Mara went and inspected the field and he reported the bad condition of the field to the coach Steve Owen. Sales in Belgium fell 0.8% in the quarter. The other European regions saw sales increase 3.5%. Beginners should first test their strength in small cap as they require even more judgment. Of course, the large cap stocks are more stable as they belong to multinational behemoths and they cost more. Despite lots of progress toward fake oakleys acceptance of marriage equality, there’s still something like more than half the country that is OK with a Baratas Ray Ban guy on a reality TV show comparing homosexuality to bestiality. Sam, or Sam’s representation, understands this. I am a coach for the Cheer Odyssey Rockets team. I’m talking a little bit about advanced cheerleadering here. ESPN NFL Draft guru Mel Kiper Jr. Generally releases four versions of mock drafts prior to the actual NFL Draft each year. The vessel can be anything from a frighteningly expensive specialized smoker, an outdoor grill outfitted with a pan of water to manage the heat, or the classic smokehouse down by the river. But for Manning, the “smoker” is just a pan, some foil, and a quick raid of cheap oakleys sunglasses the pantry.. Industry and Education in FloridaThe Florida Tourism Industry generates over $57 Billion worth of business revenues in the state every year. Information Technology (IT) is used with increasing frequency wholesale nfl jersyes in Tourism related businesses as well as in other industries, such as Healthcare. Chris Ivory A new offensive coordinator seems like he wants to utilized this offseason pick up more. In his first game under the new regime, Ivory delivered 107 yards on 18 carries. Cole signed an earlier letter with Cantwell that suggested that the Cheap NFL Jerseys use of a racial slur was inconsistent with the NFL’s status as a tax exempt organization under IRS rules. You could read that as a shot across the bow.Five Democrats didn’t sign Cantwell’s letter.

Published by

안반장

Web과 App 개발을 하고 있으며 최근 워드프레스에 관심이 많아져 네이버 카페 워드프레스 홈페이지의 TF팀으로 활동 중 입니다.개인적으로는 안반장의 개발 노트라는 블로그를 운영하면서 개발의 즐거움과 고충들을 차곡차곡 담아가고 있습니다.