开发者

UIResponder Troubles

Tonight I've been battling with UIResponder. Here's my predicament.

If I put in

- (BOOL)canBecomeFirstResponder{
    return YES;
}

to my mainViewController then I can get shake events..

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {

    if (event.type == UIEventSubtypeMotionShake) {
    开发者_如何学运维     //do something 
    }
}

However, this means that when I call things like mail forms and webviews, the keyboard does not show up.

Is there any way I can get both shakes working and keyboard working in modal views?

I've tried adding [self resignFirstResponder]; in -viewDidDissapear, which gets called when a modal pops over, but no luck.

Cheers


I had the same problem with iOS < 5.0, shake event and showing a mail form. You have to resign the first responder before the new modal view controller is being presented.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜